Skip to content

Commit

Permalink
Table add check & highlight default setting in data
Browse files Browse the repository at this point in the history
Table add check & highlight default setting in data #275 #265
  • Loading branch information
icarusion committed Feb 18, 2017
1 parent 3fd9788 commit c13e7ce
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iview",
"version": "0.9.17",
"version": "1.0.0",
"title": "iView",
"description": "A high quality UI components Library with Vue.js",
"homepage": "http://www.iviewui.com",
Expand Down
12 changes: 10 additions & 2 deletions src/components/table/table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,16 @@
this.data.forEach((row, index) => {
const newRow = deepCopy(row);// todo 直接替换
newRow._isHover = false;
newRow._isChecked = false;
newRow._isHighlight = false;
if (newRow._checked) {
newRow._isChecked = newRow._checked;
} else {
newRow._isChecked = false;
}
if (newRow._highlight) {
newRow._isHighlight = newRow._highlight;
} else {
newRow._isHighlight = false;
}
data[index] = newRow;
});
return data;
Expand Down
20 changes: 15 additions & 5 deletions test/routers/table.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<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>
<script>
export default {
data () {
return {
self: this,
columns7: [
{
type: 'selection',
width: 60,
align: 'center'
},
{
title: '姓名',
key: 'name',
Expand Down Expand Up @@ -47,22 +52,27 @@
{
name: '王小明',
age: 18,
address: '北京市朝阳区芍药居'
address: '北京市朝阳区芍药居',
_highlight: true,
_checked: true
},
{
name: '张小刚',
age: 25,
address: '北京市海淀区西二旗'
address: '北京市海淀区西二旗',
_checked: true
},
{
name: '李小红',
age: 30,
address: '上海市浦东新区世纪大道'
address: '上海市浦东新区世纪大道',
_checked: true
},
{
name: '周小伟',
age: 26,
address: '深圳市南山区深南大道'
address: '深圳市南山区深南大道',
_checked: true
}
]
}
Expand Down

0 comments on commit c13e7ce

Please sign in to comment.