iview的table实现全选

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);
  });
}

猜你喜欢

转载自blog.csdn.net/LLL_liuhui/article/details/84784246
今日推荐