mirror of
https://gitee.com/xuliangzhan_admin/vxe-table.git
synced 2026-01-21 05:27:57 +08:00
36 lines
1.2 KiB
Vue
36 lines
1.2 KiB
Vue
<template>
|
||
<div>
|
||
<p>多选表格,勾选全部事件select-all,勾选事件select-change</p>
|
||
|
||
<button class="btn" @click="$refs.xTable.toggleRowSelection(tableData[1])">切换第二行选中</button>
|
||
<button class="btn" @click="$refs.xTable.setSelection([tableData[2], tableData[3]], true)">设置第三、四行选中</button>
|
||
<button class="btn" @click="$refs.xTable.setAllSelection(true)">设置所有行选中</button>
|
||
<button class="btn" @click="$refs.xTable.clearSelection()">清除所有行选中</button>
|
||
<vxe-table
|
||
ref="xTable"
|
||
border
|
||
height="300"
|
||
:data.sync="tableData">
|
||
<vxe-table-column type="selection" width="60"></vxe-table-column>
|
||
<vxe-table-column prop="name" label="Name"></vxe-table-column>
|
||
<vxe-table-column prop="sex" label="Sex"></vxe-table-column>
|
||
<vxe-table-column prop="age" label="Age"></vxe-table-column>
|
||
<vxe-table-column prop="address" label="Address" show-overflow></vxe-table-column>
|
||
</vxe-table>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data () {
|
||
return {
|
||
tableData: []
|
||
}
|
||
},
|
||
created () {
|
||
let list = window.MOCK_DATA_LIST.slice(0, 50)
|
||
this.tableData = list
|
||
}
|
||
}
|
||
</script>
|