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

master
vdpAdmin 2022-04-21 18:04:36 +08:00
parent 1e5038f1e7
commit ec7921e620
2 changed files with 5 additions and 2 deletions

View File

@ -178,7 +178,7 @@ Github仓库<a href="https://github.com/vform666/variant-form" target="_blank
VS Code插件<a href="https://www.vform666.com/pages/plugin/" target="_blank">https://www.vform666.com/pages/plugin/</a>
更新日志:<a href="https://www.vform666.com/pages/changelog/" target="_blank">https://www.vform666.com/pages/changelog/</a>
更新日志:<a href="https://www.vform666.com/changelog.html" target="_blank">https://www.vform666.com/changelog.html</a>
技术交流群微信搜索“vformAdmin”或者扫如下二维码加群

View File

@ -224,7 +224,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'],