## 复选表格
<br />

#### 选择多行数据时使用 Checkbox。 

### 基本用法

:::demo
```html
<template>
	<div>
	    {{multipleSelection}}
	    <ve-check-table
	        ref="multipleTable"
	        :data="tableData"
	        :tableRowClassName="tableRowClassName"
	        @selection-change="handleSelectionChange"
	        @select-all="handleSelectAllChange"
	        @select="handleSelectChange"
	        :multipleSelection.sync="multipleSelection"
	        @sort-change="sortChange"
	        :defaultSort="defaultSort"
	    >
	        <el-table-column type="index" :index="(index)=>{return index+1}"></el-table-column>
	        <el-table-column prop="name" label="姓名"></el-table-column>
	        <el-table-column sortable="custom" prop="amount1" label="数值 1（元）"></el-table-column>
	        <el-table-column prop="amount2" label="数值 2（元）"></el-table-column>
	        <el-table-column prop="amount3" label="数值 3（元）"></el-table-column>
	        <el-table-column label="操作" width="150">
	            <template slot-scope="scope">
	                <el-link type="primary">查看</el-link>
	                <el-link type="warning">编辑</el-link>
	                <el-link type="danger">删除</el-link>
	            </template>
	        </el-table-column>
	    </ve-check-table>
	    <div style="margin-top: 20px">
	        <el-button @click="toggleSelection([tableData[0],tableData[1]],true)">切换第1行的选中状态</el-button>
	        <el-button @click="toggleSelection()">取消选择</el-button>
	    </div>
	    <div
	        style="margin-top: 20px;font-size:17px;font-weight:600;margin-bottom:15px;"
	    >复选合并表格{{SpanSelection}}</div>
		<ve-check-table
		    ref="multipleTableSpan"
		    :stripe="false"
		    :border="true"
		    :span-method="objectSpanMethod"
		    :data="tableData"
		    :multipleSelection.sync="SpanSelection"
		>
		    <el-table-column prop="name" label="姓名"></el-table-column>
		    <el-table-column prop="amount1" label="数值 1（元）"></el-table-column>
		    <el-table-column prop="amount2" label="数值 2（元）"></el-table-column>
		    <el-table-column prop="amount3" label="数值 3（元）"></el-table-column>
		    <el-table-column label="操作" width="150">
		        <template slot-scope="scope">
		            <el-link type="primary">查看</el-link>
		            <el-link type="warning">编辑</el-link>
		            <el-link type="danger">删除</el-link>
		        </template>
		    </el-table-column>
		</ve-check-table>
	   
	</div>
</template>

<script>
  export default {
    data () {
		return {
			multipleSelection: [],
			SpanSelection: [],
			tableData: [{
			    id: '12987122',
			    name: '王小虎',
			    amount1: '234',
			    amount2: '3.2',
			    amount3: 10
			}, {
			    id: '12987123',
			    name: '王小虎',
			    amount1: '165',
			    amount2: '4.43',
			    amount3: 12
			}, {
			    id: '12987124',
			    name: '王小虎',
			    amount1: '324',
			    amount2: '1.9',
			    amount3: 9
			}, {
			    id: '12987125',
			    name: '王小虎',
			    amount1: '621',
			    amount2: '2.2',
			    amount3: 17
			}, {
			    id: '12987126',
			    name: '王小虎',
			    amount1: '539',
			    amount2: '4.1',
			    amount3: 15
			}],
			defaultSort:{
			    prop: 'amount1',  //  排序字段
			    order: 'descending' //  排序数值 	[枚举]Y:正序;N:倒序
			}
		}
	},
	methods:{
		sortChange(sort) {
		    console.log('sort', sort);
		},
		handleSelectChange(rows,row) {
		    console.log(rows)
		    console.log(row)
		},
		toggleSelection(rows,selected) {
		    // selected 可传可不传，不传默认toggle,false取消，true选中
		    this.$refs.multipleTable.toggleSelection(rows,selected);
		},
		handleSelectAllChange(val) {
		    // console.log('handleSelectAllChange')
		    //console.log(val)
		},
		handleSelectionChange(val) {
		    // console.log('handleSelectionChange')
		    // console.log(val)
		},
		objectSpanMethod({ row, column, rowIndex, columnIndex }) {
		    if (columnIndex === 1) {
		        if (rowIndex % 2 === 0) {
		            return {
		                rowspan: 2,
		                colspan: 1
		            };
		        } else {
		            return {
		                rowspan: 0,
		                colspan: 0
		            };
		        }
		    }
		},
		tableRowClassName({ row, rowIndex }) {
		    if (rowIndex === 1) {
		        return 'danger-bg-color';
		    }
		    return '';
		},
	}
  }
</script>
```
:::

### Table Attributes

| 参数      | 说明          | 类型      | 可选值                           | 默认值  |
|---------- |-------------- |---------- |--------------------------------  |-------- |
| data     |  绑定数据           | Array | — | — |
| tableRowClassName     |  行的 className 的回调方法，也可以使用字符串为所有行设置一个固定的 className。           | Function({row, rowIndex})/String | — | — |
| multipleSelection     | 选中的条目           | Array | — | — |
| defaultSort     | 排序字段           | object | — | — |

### Table-column Attributes
| 参数      | 说明          | 类型      | 可选值                           | 默认值  |
|---------- |-------------- |---------- |--------------------------------  |-------- |
| prop     |  列prop值           | string | — | — |
| label     |  列名           | string | — | — |
| index     |  索引           | number | — | — |

### Events

| 事件名称			| 说明										| 回调参数				|
|----------			|--------									|----------				|
| selection-change	|当选择项发生变化时会触发该事件				| selection				|
|select-all			|当用户手动勾选全选 Checkbox 时触发的事件	|selection				|
|sort-change		|当表格的排序条件发生变化的时候会触发该事件	|{ column, prop, order }|
| toggleSelection	|可设置复选按钮的选中或不选					| —					|