From a118b19250faeb24f3a45c3a4173a13be85451dc Mon Sep 17 00:00:00 2001 From: bootx Date: Tue, 12 Aug 2025 20:47:06 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E8=87=AA=E5=AE=9A=E4=B9=89=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BCascader.vue | 12 ++-- src/components/BDatePicker.vue | 79 +++++++++++++++++++++ src/components/{BUpLoad.vue => BUpload.vue} | 4 +- 3 files changed, 88 insertions(+), 7 deletions(-) create mode 100644 src/components/BDatePicker.vue rename src/components/{BUpLoad.vue => BUpload.vue} (97%) diff --git a/src/components/BCascader.vue b/src/components/BCascader.vue index 89b0481..f890037 100644 --- a/src/components/BCascader.vue +++ b/src/components/BCascader.vue @@ -5,7 +5,6 @@ label-align="top" readonly :right-icon="showText ? 'clear' : ''" - :required="required" :name="name" :rules="rules" :placeholder="placeholder" @@ -34,8 +33,8 @@ // 级联窗口组件 import { ref } from 'vue' -const { label, placeholder, name, rules = [], required, optionsLevel = 3, options = [], title } - = defineProps<{ label: string, placeholder?: string, name: string, rules?: any[], required?: boolean, optionsLevel?: number, options?: any, title?: string }>() +const { label, placeholder, name, rules = [], optionsLevel = 3, options = [], title } + = defineProps<{ label: string, placeholder?: string, name: string, rules?: any[], optionsLevel?: number, options?: any, title?: string }>() const fieldNames = ref({ text: 'name', value: 'code', @@ -55,8 +54,8 @@ const cascaderValue = ref('') /** * 监听 modelValue 改变 */ -watch(() => modelValue.value, () => initData()) -watch(() => options, () => initData()) +watch(() => modelValue.value, () => initData(), { immediate: true }) +watch(() => options, () => initData(), { immediate: true }) /** * 初始化处理各项属性 */ @@ -101,6 +100,9 @@ function onFinish({ selectedOptions }) { modelValue.value = selectedOptions.map(option => option.code) } +/** + * 清除内容 + */ function onClear(e) { // 阻止冒泡到 @click e.stopPropagation() diff --git a/src/components/BDatePicker.vue b/src/components/BDatePicker.vue new file mode 100644 index 0000000..12ca057 --- /dev/null +++ b/src/components/BDatePicker.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/components/BUpLoad.vue b/src/components/BUpload.vue similarity index 97% rename from src/components/BUpLoad.vue rename to src/components/BUpload.vue index 59feb1a..2df65d8 100644 --- a/src/components/BUpLoad.vue +++ b/src/components/BUpload.vue @@ -3,7 +3,7 @@