微信小程序 时间选择
生活随笔
收集整理的這篇文章主要介紹了
微信小程序 时间选择
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
wxml
<view class="section"><picker mode="date" value="{{date}}" start="1980-01-01" end="{{ dates2 }}" bindchange="EndDate"><view class="picker">結束日期: <text style="color:blue;">{{dates2}}</text></view></picker> </view>js
data: {dates1: "2020-01-01",dates2: tody,times: "12:00",index: 0, }, // 點擊日期組件確定事件 StartDate: function (e) {console.log("StartDate>>>" + e.detail.value)this.setData({dates1: e.detail.value})},獲取當天日期
//獲取當前時間 var n = timestamp * 1000; var date = new Date(n); //年 var Y = date.getFullYear(); //月 var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1); //日 var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();var tody = Y + "-" + M + "-" + D console.log(tody)總結
以上是生活随笔為你收集整理的微信小程序 时间选择的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 微信小程序 时间操作
- 下一篇: 微信小程序 选择器