浏览代码

自定义日期选择器

zhaoxiaohai 3 年之前
父节点
当前提交
9a57e99db2
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      components/My_datePicker/index.js

+ 4 - 3
components/My_datePicker/index.js

@@ -13,6 +13,9 @@ Component({
         endDate: {
             type: String,
             value: getTime.formatTime(new Date(), '-').split(' ')[0]
+        },
+        getDate: {
+            type: Function
         }
     },
 
@@ -91,9 +94,7 @@ Component({
         }) {
             let arr = detail.value;
             this.handleChange(`${this.data.years[arr[0]]}-${this.data.months[arr[1]]}-${this.data.days[arr[2]]}`)
-            setTimeout(() => {
-                console.log(`${this.data.years[arr[0]]}-${this.data.months[arr[1]]}-${this.data.days[arr[2]]}`)
-            }, 300)
+            this.triggerEvent("getDate", `${this.data.years[arr[0]]}-${this.data.months[arr[1]]}-${this.data.days[arr[2]]}`);
         },
     }
 })