diff --git a/packages/table/editor.vue b/packages/table/editor.vue index 32487db..c4c6cf4 100644 --- a/packages/table/editor.vue +++ b/packages/table/editor.vue @@ -108,6 +108,9 @@ function editorRender(h, context, item) { const contentProps = context.props || {}; return function(scope) { const value = get(scope.row, item.prop); + if (item.if === false) { + return cellRender(h, context, item)(scope); + } if (item.if && typeof item.if === 'function') { const showEditor = item.if({ item, value, index: scope.$index, ...scope }); if (!showEditor) { @@ -118,7 +121,7 @@ function editorRender(h, context, item) { // 默认 const setValue = val => { if (get(contentProps, 'editor.force') === true) { - vnode.componentInstance.$set(scope.row, item.prop, val); + if (vnode.componentInstance) vnode.componentInstance.$set(scope.row, item.prop, val); } else { scope.row[item.prop] = val; } @@ -136,7 +139,7 @@ function editorRender(h, context, item) { const bindProp = path[0]; const propValue = cloneDeep(scope.row); set(propValue, item.prop, val); - vnode.componentInstance.$set(scope.row, bindProp, propValue[bindProp]); + if (vnode.componentInstance) vnode.componentInstance.$set(scope.row, bindProp, propValue[bindProp]); } else { setValue(val); } @@ -256,6 +259,7 @@ export default {