Table add check & highlight default setting in data

Table add check & highlight default setting in data #275 #265
This commit is contained in:
梁灏 2017-02-18 21:57:11 +08:00
parent 3fd978800f
commit c13e7cea81
3 changed files with 26 additions and 8 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "iview", "name": "iview",
"version": "0.9.17", "version": "1.0.0",
"title": "iView", "title": "iView",
"description": "A high quality UI components Library with Vue.js", "description": "A high quality UI components Library with Vue.js",
"homepage": "http://www.iviewui.com", "homepage": "http://www.iviewui.com",

View file

@ -548,8 +548,16 @@
this.data.forEach((row, index) => { this.data.forEach((row, index) => {
const newRow = deepCopy(row);// todo const newRow = deepCopy(row);// todo
newRow._isHover = false; newRow._isHover = false;
if (newRow._checked) {
newRow._isChecked = newRow._checked;
} else {
newRow._isChecked = false; newRow._isChecked = false;
}
if (newRow._highlight) {
newRow._isHighlight = newRow._highlight;
} else {
newRow._isHighlight = false; newRow._isHighlight = false;
}
data[index] = newRow; data[index] = newRow;
}); });
return data; return data;

View file

@ -1,5 +1,5 @@
<template> <template>
<i-table border :content="self" :columns="columns7" :data="data6"></i-table> <i-table highlight-row border :content="self" :columns="columns7" :data="data6"></i-table>
</template> </template>
<script> <script>
export default { export default {
@ -7,6 +7,11 @@
return { return {
self: this, self: this,
columns7: [ columns7: [
{
type: 'selection',
width: 60,
align: 'center'
},
{ {
title: '姓名', title: '姓名',
key: 'name', key: 'name',
@ -47,22 +52,27 @@
{ {
name: '王小明', name: '王小明',
age: 18, age: 18,
address: '北京市朝阳区芍药居' address: '北京市朝阳区芍药居',
_highlight: true,
_checked: true
}, },
{ {
name: '张小刚', name: '张小刚',
age: 25, age: 25,
address: '北京市海淀区西二旗' address: '北京市海淀区西二旗',
_checked: true
}, },
{ {
name: '李小红', name: '李小红',
age: 30, age: 30,
address: '上海市浦东新区世纪大道' address: '上海市浦东新区世纪大道',
_checked: true
}, },
{ {
name: '周小伟', name: '周小伟',
age: 26, age: 26,
address: '深圳市南山区深南大道' address: '深圳市南山区深南大道',
_checked: true
} }
] ]
} }