itable 添加设置默认选中行的功能

This commit is contained in:
leonine 2017-02-15 16:04:35 +08:00
parent 8f48491aa6
commit 1594942f2c
2 changed files with 40 additions and 1 deletions

View file

@ -548,7 +548,11 @@
this.data.forEach((row, index) => {
const newRow = deepCopy(row);// todo
newRow._isHover = false;
if(newRow.checked){// checked:true
newRow._isChecked = newRow.checked;
}else{
newRow._isChecked = false;
}
newRow._isHighlight = false;
data[index] = newRow;
});

View file

@ -1,5 +1,8 @@
<template>
<i-table border :content="self" :columns="columns7" :data="data6"></i-table>
默认选中行
<i-table border :content="self" :columns="columns8" :data="data8"></i-table>
</template>
<script>
export default {
@ -64,6 +67,38 @@
age: 26,
address: '深圳市南山区深南大道'
}
],
columns8:[
{
type: 'selection',
width: 60,
align: 'center'
},
{
title: '名称',
key: 'name'
},
{
title: '年龄',
key: 'age'
},
{
title: '地址',
key: 'address'
}
],
data8:[
{
name: '王小明',
age: 18,
address: '北京市朝阳区芍药居',
checked:true // checked
},
{
name: '张小刚',
age: 25,
address: '北京市海淀区西二旗'
}
]
}
},