Browse Source

fix: datepicker 2月展示bug (#430)

* feat: add datepicker

* fix: 修复datepicker问题

* fix: datepicker解决导入相关问题

* fix: picker 联动bug

* fix: picker bug

* fix: picker props

* fix: datepicker bug
kaixuan 4 years ago
parent
commit
2e3f1d542c
1 changed files with 20 additions and 11 deletions
  1. 20 11
      src/packages/datepicker/index.vue

+ 20 - 11
src/packages/datepicker/index.vue

@@ -192,17 +192,26 @@ export default create({
     });
 
     const changeHandler = (val: string[]) => {
-      // let formatDate = [];
-      // if (props.isShowChinese) {
-      //   formatDate = val.map((res: string) => {
-      //     return Number(res.slice(0, res.length - 1));
-      //   }) as any;
-      // } else {
-      //   formatDate = val;
-      // }
-      // state.currentDate = formatValue(
-      //   new Date(formatDate[0], formatDate[1] - 1, formatDate[2])
-      // );
+      if (props.type == 'datetime') {
+        let formatDate = [];
+        if (props.isShowChinese) {
+          formatDate = val.map((res: string) => {
+            return Number(res.slice(0, res.length - 1));
+          }) as any;
+        } else {
+          formatDate = val;
+        }
+        console.log(formatDate);
+        state.currentDate = formatValue(
+          new Date(
+            formatDate[0],
+            formatDate[1] - 1,
+            formatDate[2],
+            formatDate[3],
+            formatDate[4]
+          )
+        );
+      }
     };
 
     const generateValue = (