Commit 34b2385c authored by 刘玉宏's avatar 刘玉宏

校验

parent d0f15039
......@@ -103,9 +103,21 @@ const formdata = reactive<{
* 表单验证规则
*/
const rules = {
images: { required: true, message: '请上传图片' },
evaluation: { required: true, message: '请填写评价内容' },
merchantServices: { required: true, message: '请选择商家服务评分' },
images: [
{
required: true,
message: '请上传图片',
validator: (value: any) => {
if (value) {
console.log('123456');
} else {
console.log('963852');
}
},
},
],
evaluation: [{ required: true, message: '请填写评价内容' }],
merchantServices: [{ required: true, message: '请选择商家服务评分' }],
};
/**
......@@ -158,7 +170,7 @@ const deleteImg = () => {
/**
* Release提交
*/
const hdSubmit = async () => {
const handleSubmit = async () => {
await evaluation({
...formdata,
images: proImage(),
......@@ -169,20 +181,19 @@ const hdSubmit = async () => {
});
};
const handleSubmit = async () => {
console.log(form.value.validate());
form.value
.validate()
.then(({ valid, errors }) => {
console.log('valid', valid);
if (valid) {
uToast.info({ msg: '校验通过' });
}
})
.catch((error: any) => {
console.log(error, 'error');
});
};
// const handleSubmit = async () => {
// console.log(form.value.validate());
// form.value
// .validate()
// .then(({ valid, errors }) => {
// if (valid) {
// uToast.info({ msg: '校验通过' });
// }
// })
// .catch((error: any) => {
// console.log(error, 'error');
// });
// };
</script>
<style lang="scss" scoped>
.container {
......@@ -227,6 +238,9 @@ const handleSubmit = async () => {
margin-top: 25rpx;
margin-bottom: 172rpx;
padding: 20rpx;
:deep(.wd-textarea) {
padding: 0 30rpx;
}
.itemPicker {
display: flex;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment