فهرست منبع

1.修复选择年的节点时会清空days数组

GouGengquan 7 ماه پیش
والد
کامیت
5aa9447209
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      src/views/home/index.vue

+ 3 - 3
src/views/home/index.vue

@@ -223,8 +223,8 @@ export default {
     },
     // 设置横向的天数
     setDay(node) {
-      this.days = []
       if (node.year) {
+        this.days = []
         // 计算是平年还是闰年
         let dayLength = 31
         if ((node.year % 4 === 0 && node.year % 100 !== 0) || node.year % 400 === 0) {
@@ -248,9 +248,9 @@ export default {
         for (let index = 1; index <= dayLength; index++) {
           this.days.push({ id: index, date: node.year + '-' + node.month + '-' + index })
         }
+        // 默认选中当前月的第一天
+        this.choiceDay(0)
       }
-      // 默认选中当前月的第一天
-      this.choiceDay(0)
     },
     // 设置tree组件节点
     setYearMonth() {