From 64d3eae2852d17c3bbade662d3f7a7c47d681ad6 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 19 三月 2026 14:17:04 +0800
Subject: [PATCH] 2026.3.19
---
src/components/search-option/FYOptionTime.vue | 60 +++++++++++++++++++++++++++++++++++-------------------------
1 files changed, 35 insertions(+), 25 deletions(-)
diff --git a/src/components/search-option/FYOptionTime.vue b/src/components/search-option/FYOptionTime.vue
index e1fa691..52180c5 100644
--- a/src/components/search-option/FYOptionTime.vue
+++ b/src/components/search-option/FYOptionTime.vue
@@ -14,66 +14,76 @@
</template>
<script>
-import dayjs from 'dayjs';
+import dayjs from 'dayjs'
-const MONTH = 'month';
-const DATE = 'date';
-const RANGE = 'datetimerange';
-const RANGE2 = 'daterange';
+const MONTH = 'month'
+const DATE = 'date'
+const RANGE = 'datetimerange'
+const RANGE2 = 'daterange'
export default {
props: {
type: {
type: String,
- default: MONTH
+ default: MONTH,
},
// 杩斿洖缁撴灉
value: Date || Array,
// 鏄惁榛樿杩斿洖鍒濆閫夐」
initValue: {
type: Boolean,
- default: true
+ default: true,
},
label: {
type: String,
- default: '鏃堕棿'
+ default: '鏃堕棿',
},
prop: {
type: String,
- default: 'time'
- }
+ default: 'time',
+ },
},
emits: ['update:value', 'change'],
data() {
return {
- date: this.value
- };
+ date: this.value,
+ }
+ },
+ watch: {
+ value: {
+ handler(newVal, oldVal) {
+ if (newVal != oldVal) {
+ this.date = newVal
+ }
+ },
+ immediate: true,
+ },
},
computed: {},
methods: {
handleChange(value) {
- this.$emit('update:value', value);
- this.$emit('change', value);
- }
+ this.$emit('update:value', value)
+ this.$emit('change', value)
+ },
},
mounted() {
if (this.initValue) {
switch (this.type) {
case RANGE:
case RANGE2:
- this.date = [dayjs().startOf('month').toDate(), dayjs().toDate()];
- break;
+ this.date = [dayjs().startOf('month').toDate(), dayjs().toDate()]
+ break
case MONTH:
- this.date = dayjs().startOf('month').toDate();
- break;
+ this.date = dayjs().startOf('month').toDate()
+ break
case DATE:
- this.date = dayjs().toDate();
- break;
+ this.date = dayjs().toDate()
+ break
default:
- break;
+ break
}
- this.handleChange(this.date);
+ this.handleChange(this.date)
}
- }
-};
+ },
+}
</script>
--
Gitblit v1.9.3