From 1996a4f74500a5ccdd18d77e99063ab2931e7fb4 Mon Sep 17 00:00:00 2001 From: "daniel.xiao" Date: Mon, 29 Oct 2018 15:26:25 +0800 Subject: [PATCH] fix(ncform): restore dirty status when reset --- packages/ncform/src/components/vue-ncform/ncform.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/ncform/src/components/vue-ncform/ncform.vue b/packages/ncform/src/components/vue-ncform/ncform.vue index 1c57fd1..24dedd9 100755 --- a/packages/ncform/src/components/vue-ncform/ncform.vue +++ b/packages/ncform/src/components/vue-ncform/ncform.vue @@ -68,6 +68,7 @@ export default { this.$watch('value', (newVal, oldVal) => { if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) { if (!this.$options.isValueUpdateFromInner) { + // 外部更新值 this.$data.isSchemaChanging = true; this.$nextTick(() => { this.$data.isSchemaChanging = false; @@ -84,6 +85,7 @@ export default { ); } } + this.$options.isValueUpdateFromInner = false; // reset }); @@ -262,6 +264,7 @@ export default { reset() { this.$options.isValueUpdateFromInner = false; // 通过模拟外部赋值来达到重置的目的 + this.$emit('update:isDirty', false); // 表单回到not dirty状态 this.$emit('input', this.$options.originFormVal); } },