update Table

update Table
This commit is contained in:
梁灏 2016-11-28 14:23:49 +08:00
parent 52874e27e5
commit 741b987a33
6 changed files with 100 additions and 38 deletions

View file

@ -1,8 +1,8 @@
<template>
<div :class="classes">
<template v-if="renderType === 'index'">{{index + 1}}</template>
<template v-if="renderType === 'index'">{{naturalIndex + 1}}</template>
<template v-if="renderType === 'selection'">
<Checkbox :checked="checked" @on-change="toggleSelect(index)"></Checkbox>
<Checkbox :checked="checked" @on-change="toggleSelect">{{checked}}</Checkbox>
</template>
<template v-if="renderType === 'normal'">{{{ row[column.key] }}}</template>
</div>
@ -16,7 +16,8 @@
prefixCls: String,
row: Object,
column: Object,
index: Number,
naturalIndex: Number, // index of rebuildData
index: Number, // _index of data
checked: Boolean,
fixed: Boolean
},
@ -62,8 +63,8 @@
}
}
},
toggleSelect (index) {
this.$parent.$parent.toggleSelect(index);
toggleSelect () {
this.$parent.$parent.toggleSelect(this.index);
}
},
compiled () {
@ -84,7 +85,7 @@
this.destroy();
},
watch: {
index () {
naturalIndex () {
this.destroy();
this.compile();
}