From ccc970e575ef3f3e5c67af8da210263f4ac549f9 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期五, 10 四月 2026 16:44:55 +0800
Subject: [PATCH] 2026.4.10

---
 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