el-dialog下的table怎么默认选中,下面是代码
<el-dialog title="配置" :visible.sync="conVisible" width="300" :before-close="optHandleClose">
<el-form :label-position="'left'" label-width="100px">
<el-form-item label="功能名称">
<el-input type="text" v-model="optList.name" auto-complete="off" readonly></el-input>
</el-form-item>
<el-form-item label="功能代码">
<el-input type="text" v-model="optList.code" auto-complete="off" readonly></el-input>
<el-table :show-header="false" :data="optList.pageDate" border ref="table" style="width: 100%" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55">
</el-table-column>
<el-table-column
prop="name">
</el-table-column>
<el-table-column
prop="code">
</el-table-column>
</el-table>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="conVisible = false">取 消</el-button>
<el-button type="primary" @click="optHandleConfirm" :loading="conBtnLoading">确 定</el-button>
</span>
</el-dialog>
效果图
数据
数据中有check的打开dialog就默认选中
求大神
楼上的兄弟已经说的很清楚了,dialog的open事件遍历下表格的数据,将
check
为checked
数据用表格的toggleRowSelection
方法设置选中