iview的table實現全選
阿新 • • 發佈:2018-12-04
1、html
<Table border height="500" :columns="columns" :data="dataSource" :loading="loading"
@on-selection-change="selectRow"
></Table>
2、js
columns: [ { type: 'selection', width: 60, align: 'center' }, { title: '單位', key: 'xxx', algin: 'center', width: 100 }, ],
3、方法
getsxv(){
axios.get('/user')
.then(function (res) {
for (let i =0; i<res.length; i++) {
res[i]._checked = true;
}
})
.catch(function (error) {
console.log(error);
});
}