Commit 1e20ac5cf4f5058834743404a30700b08d3d8cd0
1 parent
3f17939d
#958
Showing
3 changed files
with
10 additions
and
15 deletions
Show diff stats
examples/routers/table.vue
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | data () { |
12 | 12 | return { |
13 | 13 | data1: 1, |
14 | -// self: this, | |
14 | + self: this, | |
15 | 15 | columns7: [ |
16 | 16 | { |
17 | 17 | title: '姓名', |
... | ... | @@ -42,9 +42,9 @@ |
42 | 42 | key: 'action', |
43 | 43 | width: 150, |
44 | 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 | - } | |
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 | 48 | } |
49 | 49 | ], |
50 | 50 | data6: [ | ... | ... |
src/components/form/form.vue
1 | 1 | <template> |
2 | - <form :class="classes" @submit="formSubmit"> | |
3 | - <slot></slot> | |
4 | - </form> | |
2 | + <form :class="classes" @submit="formSubmit"><slot></slot></form> | |
5 | 3 | </template> |
6 | 4 | <script> |
7 | 5 | // https://github.com/ElemeFE/element/blob/dev/packages/form/src/form.vue |
... | ... | @@ -78,7 +76,7 @@ |
78 | 76 | |
79 | 77 | field.validate('', cb); |
80 | 78 | }, |
81 | - formSubmit(event){ | |
79 | + formSubmit (event) { | |
82 | 80 | event.preventDefault(); |
83 | 81 | } |
84 | 82 | }, | ... | ... |
src/components/table/cell.vue
... | ... | @@ -10,6 +10,7 @@ |
10 | 10 | <script> |
11 | 11 | import Vue from 'vue'; |
12 | 12 | import Checkbox from '../checkbox/checkbox.vue'; |
13 | + import { findComponentUpward } from '../../utils/assist'; | |
13 | 14 | |
14 | 15 | export default { |
15 | 16 | name: 'TableCell', |
... | ... | @@ -49,13 +50,9 @@ |
49 | 50 | compile () { |
50 | 51 | if (this.column.render) { |
51 | 52 | // 兼容真 Render,后期废弃旧用法 |
52 | - let isRealRender = false; | |
53 | - try { | |
54 | - this.column.render(this.row, this.column, this.index); | |
55 | - } | |
56 | - catch (err) { | |
57 | - isRealRender = true; | |
58 | - } | |
53 | + let isRealRender = true; | |
54 | + const Table = findComponentUpward(this, 'Table'); | |
55 | + if (Table.context) isRealRender = false; | |
59 | 56 | |
60 | 57 | if (isRealRender) { |
61 | 58 | const component = new Vue({ | ... | ... |