Browse Source

save form 重置问题

wolyshaw 4 years ago
parent
commit
674be60517
2 changed files with 12 additions and 5 deletions
  1. 5 0
      src/components/save-form/README.md
  2. 7 5
      src/components/save-form/index.vue

+ 5 - 0
src/components/save-form/README.md

@@ -31,3 +31,8 @@
 
 ###### 其他:
 请在`@/router/notKeepAliveList`中添加当页路由,保证当前页面不会keepAlive
+
+##### 已知问题
+
+1. 点击重置按钮无效
+请添加`noclear`属性

+ 7 - 5
src/components/save-form/index.vue

@@ -14,7 +14,7 @@
 import { Searchs } from '@/helpers'
 export default {
   name: 'save-form',
-  props: ['model', 'save-key'],
+  props: ['model', 'save-key', 'noclear'],
   data() {
     return {
       searchs: null
@@ -55,10 +55,12 @@ export default {
       evt.preventDefault()
       if (this.$listeners.reset) {
         this.$listeners.reset()
-        this.$nextTick(() => {
-          this.resetFields()
-          // this.setFormValue()
-        })
+        if (this.noclear == undefined) {
+          this.$nextTick(() => {
+            this.resetFields()
+            // this.setFormValue()
+          })
+        }
 
       } else {
         this.resetFields()