@ddwl/ddwl-ui 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -71,9 +71,9 @@ export default {
|
|
|
71
71
|
type: String,
|
|
72
72
|
default: '取消'
|
|
73
73
|
},
|
|
74
|
-
// 需要重置的表单ref
|
|
74
|
+
// 需要重置的表单ref, 支持ref字符串或ref对象或ref字符串|对象数组
|
|
75
75
|
formRefs: {
|
|
76
|
-
type: [String, Array],
|
|
76
|
+
type: [String, Object, Array],
|
|
77
77
|
default: ''
|
|
78
78
|
},
|
|
79
79
|
width: {
|
|
@@ -106,14 +106,17 @@ export default {
|
|
|
106
106
|
}
|
|
107
107
|
},
|
|
108
108
|
methods: {
|
|
109
|
+
getRef (ref) {
|
|
110
|
+
return typeof ref === 'string' ? this.$parent.$refs[ref] : ref
|
|
111
|
+
},
|
|
109
112
|
async submit () {
|
|
110
113
|
// 是否需要进行表单校验
|
|
111
114
|
if (this.formRefs) {
|
|
112
115
|
// 多表单校验
|
|
113
116
|
if (Array.isArray(this.formRefs)) {
|
|
114
|
-
await Promise.all(this.formRefs.map(ref => this
|
|
117
|
+
await Promise.all(this.formRefs.map(ref => this.getRef(ref)?.validate()))
|
|
115
118
|
} else {
|
|
116
|
-
this
|
|
119
|
+
await this.getRef(this.formRefs)?.validate()
|
|
117
120
|
}
|
|
118
121
|
}
|
|
119
122
|
this.loading = true
|
|
@@ -129,16 +132,16 @@ export default {
|
|
|
129
132
|
this.visible = false
|
|
130
133
|
},
|
|
131
134
|
/**
|
|
132
|
-
* @description:
|
|
135
|
+
* @description: 弹窗关闭时清除表单校验
|
|
133
136
|
*/
|
|
134
137
|
closed () {
|
|
135
138
|
this.$emit('closed')
|
|
136
139
|
if (this.formRefs) {
|
|
137
140
|
// 多表单校验
|
|
138
141
|
if (Array.isArray(this.formRefs)) {
|
|
139
|
-
this.formRefs.forEach(ref => this
|
|
142
|
+
this.formRefs.forEach(ref => this.getRef(ref)?.resetFields())
|
|
140
143
|
} else {
|
|
141
|
-
this
|
|
144
|
+
this.getRef(this.formRefs)?.resetFields()
|
|
142
145
|
}
|
|
143
146
|
}
|
|
144
147
|
}
|
|
@@ -92,14 +92,17 @@ export default {
|
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
94
|
methods: {
|
|
95
|
+
getRef (ref) {
|
|
96
|
+
return typeof ref === 'string' ? this.$parent.$refs[ref] : ref
|
|
97
|
+
},
|
|
95
98
|
async submit () {
|
|
96
99
|
// 是否需要进行表单校验
|
|
97
100
|
if (this.formRefs) {
|
|
98
101
|
// 多表单校验
|
|
99
102
|
if (Array.isArray(this.formRefs)) {
|
|
100
|
-
await Promise.all(this.formRefs.map(ref => this
|
|
103
|
+
await Promise.all(this.formRefs.map(ref => this.getRef(ref)?.validate()))
|
|
101
104
|
} else {
|
|
102
|
-
this
|
|
105
|
+
await this.getRef(this.formRefs)?.validate()
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
this.loading = true
|
|
@@ -115,15 +118,16 @@ export default {
|
|
|
115
118
|
this.visible = false
|
|
116
119
|
},
|
|
117
120
|
/**
|
|
118
|
-
* @description:
|
|
121
|
+
* @description: 弹窗关闭时清除表单校验
|
|
119
122
|
*/
|
|
120
123
|
closed () {
|
|
124
|
+
this.$emit('closed')
|
|
121
125
|
if (this.formRefs) {
|
|
122
126
|
// 多表单校验
|
|
123
127
|
if (Array.isArray(this.formRefs)) {
|
|
124
|
-
this.formRefs.forEach(ref => this
|
|
128
|
+
this.formRefs.forEach(ref => this.getRef(ref)?.resetFields())
|
|
125
129
|
} else {
|
|
126
|
-
this
|
|
130
|
+
this.getRef(this.formRefs)?.resetFields()
|
|
127
131
|
}
|
|
128
132
|
}
|
|
129
133
|
}
|