给onValidate交互事件绑定this对象。

This commit is contained in:
vdpAdmin 2022-04-21 18:06:16 +08:00
parent 6d48f2271a
commit d0948f36e5

View File

@ -233,7 +233,10 @@ export default {
}
if (!!this.field.options.onValidate) {
let customFn = new Function('rule', 'value', 'callback', this.field.options.onValidate)
let customFn = (rule, value, callback) => {
let tmpFunc = new Function('rule', 'value', 'callback', this.field.options.onValidate)
return tmpFunc.call(this, rule, value, callback)
}
this.rules.push({
validator: customFn,
trigger: ['blur', 'change'],