5
vue表单必填项前面添加红色*
source link: https://blog.51cto.com/u_14682436/5882598
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
vue表单必填项前面添加红色*
精选 原创vue 表单必填项前面添加红色*和提示信息
1.效果图
2.实现代码
(1)from表单定义 :rules=“rules” ,:model=“headerForm”
(2)文本框或者下拉框 定义 :rules=“rules.XXXX” ,prop=“XXXX”
(3) js代码添加rules以及文本框或下拉框定义的 rules.XXXX
(4)防止保存请求后台接口,做下保存前的验证
// 保存前验证处理
if (!valid) {
this.$notify.error({
title: "提示",
message: "当前输入项有错误,请检查",
});
return;
}
});
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK