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,7 +11,7 @@ | ||
| 11 | data () { | 11 | data () { |
| 12 | return { | 12 | return { |
| 13 | data1: 1, | 13 | data1: 1, |
| 14 | -// self: this, | 14 | + self: this, |
| 15 | columns7: [ | 15 | columns7: [ |
| 16 | { | 16 | { |
| 17 | title: '姓名', | 17 | title: '姓名', |
| @@ -42,9 +42,9 @@ | @@ -42,9 +42,9 @@ | ||
| 42 | key: 'action', | 42 | key: 'action', |
| 43 | width: 150, | 43 | width: 150, |
| 44 | align: 'center', | 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 | data6: [ | 50 | data6: [ |
src/components/form/form.vue
| 1 | <template> | 1 | <template> |
| 2 | - <form :class="classes" @submit="formSubmit"> | ||
| 3 | - <slot></slot> | ||
| 4 | - </form> | 2 | + <form :class="classes" @submit="formSubmit"><slot></slot></form> |
| 5 | </template> | 3 | </template> |
| 6 | <script> | 4 | <script> |
| 7 | // https://github.com/ElemeFE/element/blob/dev/packages/form/src/form.vue | 5 | // https://github.com/ElemeFE/element/blob/dev/packages/form/src/form.vue |
| @@ -78,7 +76,7 @@ | @@ -78,7 +76,7 @@ | ||
| 78 | 76 | ||
| 79 | field.validate('', cb); | 77 | field.validate('', cb); |
| 80 | }, | 78 | }, |
| 81 | - formSubmit(event){ | 79 | + formSubmit (event) { |
| 82 | event.preventDefault(); | 80 | event.preventDefault(); |
| 83 | } | 81 | } |
| 84 | }, | 82 | }, |
src/components/table/cell.vue
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | <script> | 10 | <script> |
| 11 | import Vue from 'vue'; | 11 | import Vue from 'vue'; |
| 12 | import Checkbox from '../checkbox/checkbox.vue'; | 12 | import Checkbox from '../checkbox/checkbox.vue'; |
| 13 | + import { findComponentUpward } from '../../utils/assist'; | ||
| 13 | 14 | ||
| 14 | export default { | 15 | export default { |
| 15 | name: 'TableCell', | 16 | name: 'TableCell', |
| @@ -49,13 +50,9 @@ | @@ -49,13 +50,9 @@ | ||
| 49 | compile () { | 50 | compile () { |
| 50 | if (this.column.render) { | 51 | if (this.column.render) { |
| 51 | // 兼容真 Render,后期废弃旧用法 | 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 | if (isRealRender) { | 57 | if (isRealRender) { |
| 61 | const component = new Vue({ | 58 | const component = new Vue({ |