1.@tap换成@click
@tap= => @click=
2.key不适用表达式
:key="'con'+index" => :key="conIndex"
3.uviewui,小程序端表单提交验证失效,按钮提交失效
手动验证,使用原生button,不使用u-form,不使用u-button
export const checkRules = (params, rules) => { //表单校验
for (let key in rules) {
let arr = rules[key]
for (let i = 0; i < arr.length; i++) {
let rule = arr[i],
val = params[key] === 0 ? '0' : params[key] || ''
if (rule.required && val === '') { //非空
uni.showToast({
title: rule.message,
icon: "none"
});
return false
}
if (rule.pattern && !rule.pattern.test(val)) { //正则
uni.showToast({
title: rule.message,
icon: "none"
});
return false
}
}
}
return true
}
let valid = this.$checkRules(this.form, this.rules);
if (!valid) {
return false;
}