From d0948f36e5366bfbadd4aeef20bcde69264b462f Mon Sep 17 00:00:00 2001 From: vdpAdmin Date: Thu, 21 Apr 2022 18:06:16 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99onValidate=E4=BA=A4=E4=BA=92=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E7=BB=91=E5=AE=9Athis=E5=AF=B9=E8=B1=A1=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form-designer/form-widget/field-widget/fieldMixin.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/form-designer/form-widget/field-widget/fieldMixin.js b/src/components/form-designer/form-widget/field-widget/fieldMixin.js index c1f3988..7fb587c 100644 --- a/src/components/form-designer/form-widget/field-widget/fieldMixin.js +++ b/src/components/form-designer/form-widget/field-widget/fieldMixin.js @@ -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'],