Commit 10d3a3238a25f4188466c08a6a952fe2dacff46e

Authored by Aresn
1 parent ea9620eb

fixed #1011

Showing 2 changed files with 17 additions and 65 deletions   Show diff stats
examples/routers/table.vue
1 1 <template>
2   - <div>
3   - <Table border :columns="columns7" :data="data6"></Table>
4   - <Button @click="handleAdd"> + 1</Button>
5   - </div>
  2 + <Table border :columns="columns5" :data="data5"></Table>
6 3 </template>
7 4 <script>
8   - import abc from '../components/test.vue';
9 5 export default {
10   - components: { abc },
11 6 data () {
12 7 return {
13   - data1: 1,
14   - self: this,
15   - columns7: [
  8 + columns5: [
  9 + {
  10 + title: '日期',
  11 + key: 'date',
  12 + sortable: true
  13 + },
16 14 {
17 15 title: '姓名',
18 16 key: 'name',
19   -// render (row, column, index) {
20   -// return `<abc></abc>`;
21   -// }
22   - render: (h, row, column, index) => {
23   - return h('div', [
24   - h('Button',{
25   - on: {
26   - click: this.handleClick
27   - }
28   - }, 'hello')
29   - ])
  17 + render: (h, params) => {
  18 + return h('div', params.row.name);
30 19 }
31 20 },
32 21 {
33 22 title: '年龄',
34   - key: 'age'
  23 + key: 'age',
  24 + sortable: true
35 25 },
36 26 {
37 27 title: '地址',
38 28 key: 'address'
39   - },
40   - {
41   - title: '操作',
42   - key: 'action',
43   - width: 150,
44   - align: 'center',
45   -// render (row, column, index) {
46   -// return `<i-button type="primary" size="small" @click="show(${index})">查看</i-button> <i-button type="error" size="small" @click="remove(${index})">删除</i-button>`;
47   -// }
48 29 }
49 30 ],
50   - data6: [
  31 + data5: [
51 32 {
52 33 name: '王小明',
53 34 age: 18,
54   - address: '北京市朝阳区芍药居'
  35 + address: '北京市朝阳区芍药居',
  36 + date: '2016-10-03'
55 37 },
56 38 {
57 39 name: '张小刚',
58 40 age: 25,
59   - address: '北京市海淀区西二旗'
60   - },
61   - {
62   - name: '李小红',
63   - age: 30,
64   - address: '上海市浦东新区世纪大道'
65   - },
66   - {
67   - name: '周小伟',
68   - age: 26,
69   - address: '深圳市南山区深南大道'
  41 + address: '北京市海淀区西二旗',
  42 + date: '2016-10-01'
70 43 }
71 44 ]
72 45 }
73   - },
74   - computed: {
75   - ttt () {
76   - return this.data1 + 1;
77   - }
78   - },
79   - methods: {
80   - show (index) {
81   - this.$Modal.info({
82   - title: '用户信息',
83   - content: `姓名:${this.data6[index].name}<br>年龄:${this.data6[index].age}<br>地址:${this.data6[index].address}`
84   - })
85   - },
86   - remove (index) {
87   - this.data6.splice(index, 1);
88   - },
89   - handleAdd () {
90   - this.data1++;
91   - },
92   - handleClick () {
93   - this.$Message.info('111')
94   - }
95 46 }
96 47 }
97 48 </script>
... ...
src/components/table/cell.vue
... ... @@ -55,6 +55,7 @@
55 55 if (Table.context) isRealRender = false;
56 56  
57 57 if (isRealRender) {
  58 + this.$el.innerHTML = '';
58 59 const component = new Vue({
59 60 functional: true,
60 61 render: (h) => {
... ...