diff --git a/components/dForm/index.vue b/components/dForm/index.vue index 8db56cf..5e36cea 100644 --- a/components/dForm/index.vue +++ b/components/dForm/index.vue @@ -10,34 +10,36 @@ class="ml10">{{item.unit?item.unit:""}} - - + - + + v-for="option in item.options" :key="option.value" :label="option.name" :name="option.value"> - + - + - + + + 提交 @@ -50,7 +52,8 @@ import { reactive, ref, - computed + computed, + watch, } from "vue" const { list, @@ -66,12 +69,18 @@ }, isFooter: true }) - const emit = defineEmits(['submit']) + const emit = defineEmits(['submit', 'input']) const formData = reactive({ name: "" }) + + watch(formData, (val) => { + emit('input', val) + }) + const sheet = reactive({ show: false, + key: null, actions: [], title: "", description: "" @@ -89,6 +98,7 @@ // 开启弹框 const open = (item) => { sheet.show = true + sheet.key = item.key sheet.actions = item.options sheet.title = item.placeholder sheet.description = item.description || "" @@ -100,8 +110,13 @@ // 选择 const handleSelect = (val) => { - console.log(val) + formData[sheet.key] = val?.value } + + const getDesc = (val, options) => { + return options.find(item => item.value === val)?.name + } + // 上传 const afterRead = () => {} // 删除上传文件 @@ -115,11 +130,17 @@ } }) } + + const validate = () => { + return dFormRef.value.validate() + } + + defineExpose({ validate }) \ No newline at end of file diff --git a/otherPages/authentication/examination/start.vue b/otherPages/authentication/examination/start.vue index 237dc59..4fc9131 100644 --- a/otherPages/authentication/examination/start.vue +++ b/otherPages/authentication/examination/start.vue @@ -6,7 +6,9 @@ 您选择的宠物类型 - + + + @@ -30,8 +32,9 @@ - - 剩余考试次数:3次 + + + 剩余考试机会:{{ restTimes }}次 开始考试 @@ -41,6 +44,18 @@