去除rules用ref包装

pull/3/head
LiuJiaNan 2024-02-29 16:03:04 +08:00
parent 077432b715
commit 30233b73bd
4 changed files with 8 additions and 8 deletions

View File

@ -42,11 +42,11 @@ const props = defineProps({
}); });
const emits = defineEmits(["update:visible", "get-data"]); const emits = defineEmits(["update:visible", "get-data"]);
const visible = useVModel(props, "visible", emits); const visible = useVModel(props, "visible", emits);
const rules = ref({ const rules = {
NAME: [{ required: true, message: "视频名称不能为空", trigger: "blur" }], NAME: [{ required: true, message: "视频名称不能为空", trigger: "blur" }],
DESCR: [{ required: true, message: "内容不能为空", trigger: "blur" }], DESCR: [{ required: true, message: "内容不能为空", trigger: "blur" }],
file: [{ required: true, message: "请上传附件", trigger: "change" }], file: [{ required: true, message: "请上传附件", trigger: "change" }],
}); };
const formRef = ref(null); const formRef = ref(null);
const form = ref({ const form = ref({
NAME: "", NAME: "",

View File

@ -51,12 +51,12 @@ const props = defineProps({
}); });
const emits = defineEmits(["update:visible", "get-data"]); const emits = defineEmits(["update:visible", "get-data"]);
const visible = useVModel(props, "visible", emits); const visible = useVModel(props, "visible", emits);
const rules = ref({ const rules = {
TYPE: [{ required: true, message: "请选择类型", trigger: "change" }], TYPE: [{ required: true, message: "请选择类型", trigger: "change" }],
TITLE: [{ required: true, message: "请输入标题", trigger: "blur" }], TITLE: [{ required: true, message: "请输入标题", trigger: "blur" }],
CONTENT: [{ required: true, message: "请输入内容", trigger: "blur" }], CONTENT: [{ required: true, message: "请输入内容", trigger: "blur" }],
file: [{ required: true, message: "请上传附件", trigger: "change" }], file: [{ required: true, message: "请上传附件", trigger: "change" }],
}); };
const formRef = ref(null); const formRef = ref(null);
const form = ref({ const form = ref({
TYPE: "", TYPE: "",

View File

@ -60,7 +60,7 @@ const props = defineProps({
}); });
const emits = defineEmits(["update:visible", "get-data"]); const emits = defineEmits(["update:visible", "get-data"]);
const visible = useVModel(props, "visible", emits); const visible = useVModel(props, "visible", emits);
const rules = ref({ const rules = {
NAME: [{ required: true, message: "名称不能为空", trigger: "blur" }], NAME: [{ required: true, message: "名称不能为空", trigger: "blur" }],
STUDY_TYPE: [ STUDY_TYPE: [
{ required: true, message: "学习类型不能为空", trigger: "blur" }, { required: true, message: "学习类型不能为空", trigger: "blur" },
@ -68,7 +68,7 @@ const rules = ref({
STUDY_USER_NAMES: [ STUDY_USER_NAMES: [
{ required: true, message: "请选择学习人员", trigger: "change" }, { required: true, message: "请选择学习人员", trigger: "change" },
], ],
}); };
const formRef = ref(null); const formRef = ref(null);
const form = ref({ const form = ref({
NAME: "", NAME: "",

View File

@ -97,14 +97,14 @@ import { ElMessage } from "element-plus";
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const { PROMISE_ID } = route.query; const { PROMISE_ID } = route.query;
const rules = ref({ const rules = {
PROMISE_NAME: [ PROMISE_NAME: [
{ required: true, message: "请输入承诺书名称", trigger: "blur" }, { required: true, message: "请输入承诺书名称", trigger: "blur" },
], ],
TYPE: [{ required: true, message: "请选择类型", trigger: "blur" }], TYPE: [{ required: true, message: "请选择类型", trigger: "blur" }],
LEVEL: [{ required: true, message: "请选择级别", trigger: "blur" }], LEVEL: [{ required: true, message: "请选择级别", trigger: "blur" }],
TEXT: [{ required: true, message: "请输入正文", trigger: "blur" }], TEXT: [{ required: true, message: "请输入正文", trigger: "blur" }],
}); };
const form = ref({ const form = ref({
PROMISE_NAME: "", PROMISE_NAME: "",
TYPE: "", TYPE: "",