浏览代码

fix: calendar 组件问题修复 (#1037)

lkjh3214 3 年之前
父节点
当前提交
29cca29365

+ 1 - 2
src/packages/__VUE/calendaritem/index.taro.vue

@@ -456,9 +456,8 @@ export default create({
       state.propEndDate = propEndDate;
       state.startData = splitDate(propStartDate);
       state.endData = splitDate(propEndDate);
-
       // 根据是否存在默认时间,初始化当前日期,
-      if (!props.defaultValue || !(Array.isArray(props.defaultValue) && props.defaultValue.length > 0)) {
+      if (!props.defaultValue || (Array.isArray(props.defaultValue) && props.defaultValue.length <= 0)) {
         state.currDate = state.isRange ? [Utils.date2Str(new Date()), Utils.getDay(1)] : Utils.date2Str(new Date());
       } else {
         state.currDate = state.isRange ? [...props.defaultValue] : props.defaultValue;

+ 1 - 1
src/packages/__VUE/calendaritem/index.vue

@@ -437,7 +437,7 @@ export default create({
       state.endData = splitDate(propEndDate);
 
       // 根据是否存在默认时间,初始化当前日期,
-      if (!props.defaultValue || !(Array.isArray(props.defaultValue) && props.defaultValue.length > 0)) {
+      if (!props.defaultValue || (Array.isArray(props.defaultValue) && props.defaultValue.length <= 0)) {
         state.currDate = state.isRange ? [Utils.date2Str(new Date()), Utils.getDay(1)] : Utils.date2Str(new Date());
       } else {
         state.currDate = state.isRange ? [...props.defaultValue] : props.defaultValue;

+ 1 - 1
src/sites/mobile-taro/vue/project.config.json

@@ -48,4 +48,4 @@
   "condition": {
     "miniprogram": {}
   }
-}
+}