mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-11-29 18:48:32 +08:00
fix: form trigger twice validate
This commit is contained in:
parent
15300a958e
commit
36ee580f72
@ -1 +1 @@
|
||||
Subproject commit bf88dd3b3e299ab1e7af59c2a8938663ecd24835
|
||||
Subproject commit 60cb5c8b276b8d5a8c7fc9f8cb39053a14e242ee
|
@ -25,6 +25,7 @@ import { validateRules } from './utils/validateUtil';
|
||||
import { getNamePath } from './utils/valueUtil';
|
||||
import { toArray } from './utils/typeUtil';
|
||||
import { warning } from '../vc-util/warning';
|
||||
import find from 'lodash/find';
|
||||
|
||||
const iconMap = {
|
||||
success: CheckCircleFilled,
|
||||
@ -228,7 +229,12 @@ export default {
|
||||
this.required !== undefined ? { required: !!this.required, trigger: 'change' } : [];
|
||||
const prop = getPropByPath(formRules, this.namePath);
|
||||
formRules = formRules ? prop.o[prop.k] || prop.v : [];
|
||||
return [].concat(selfRules || formRules || []).concat(requiredRule);
|
||||
const rules = [].concat(selfRules || formRules || []);
|
||||
if (find(rules, rule => rule.required)) {
|
||||
return rules;
|
||||
} else {
|
||||
return rules.concat(requiredRule);
|
||||
}
|
||||
},
|
||||
getFilteredRule(trigger) {
|
||||
const rules = this.getRules();
|
||||
|
@ -4,7 +4,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import demo from '../antdv-demo/docs/upload/demo/picture-style';
|
||||
import demo from '../antdv-demo/docs/form/demo/validation';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
@ -189,7 +189,7 @@
|
||||
"@simonwep/pickr": "~1.7.0",
|
||||
"add-dom-event-listener": "^1.0.2",
|
||||
"array-tree-filter": "^2.1.0",
|
||||
"async-validator": "^3.0.3",
|
||||
"async-validator": "^3.3.0",
|
||||
"babel-helper-vue-jsx-merge-props": "^2.0.3",
|
||||
"classnames": "^2.2.5",
|
||||
"component-classes": "^1.2.6",
|
||||
|
Loading…
Reference in New Issue
Block a user