export default {
data() {
let validatePasscode = (rule, value, callback) => {
console.log(this.edit);
if (!this.edit) {
this.$api
.isaccessDictvalidate({
query: {
code: this.formData.code,
},
})
.then((res) => {
console.log(res);
if (res.code == 1) {
callback(new Error("已经存在,不能重复"));
} else {
callback();
}
});
} else {
callback();
}
};
return {
rules: {
appId: [
{ required: true, message: "请选择关联应用", trigger: "change" },
{ required: true, trigger: "change", validator: validatePasscode },
],}
}
}
}
表单验证时调用接口
最新推荐文章于 2024-01-25 09:27:48 发布