微信小程式的年月日-年月日選擇器基於picker的mode = multiSelector日期範圍
阿新 • • 發佈:2020-07-15
const date = new Date(); const years = []; const months = []; const days = []; const years2 = []; const months2 = []; const days2 = []; const yearIndex = date.getFullYear()-2010 const monthIndex = date.getMonth() const dayIndex = date.getDate() - 1 //獲取年 i是起始年份, i<=結束年份(當前年份+5) for (let i = 2010; i <= date.getFullYear() + 5 ; i++) { years.push("" + i); } //獲取月份 for (let i = 1; i <= 12; i++) { if (i < 10) { i = "0" + i; } months.push("" + i); } //獲取日期 for (let i = 1; i <= 31; i++) { if (i < 10) { i = "0" + i; } days.push("" + i); } //獲取第二行年份 for (let i = 2010; i <= date.getFullYear() + 5 ; i++) { years2.push("" + i); } //獲取第二行月份 for (let i = 1; i <= 12; i++) { if (i < 10) { i = "0" + i; } months2.push("" + i); } //獲取第二行日期 for (let i = 1; i <= 31; i++) { if (i < 10) { i = "0" + i; } days2.push("" + i); }
微信小程式的雙時間選擇器基於picker的mode = multiSelector
<picker
mode="multiSelector"
bindchange="bindMultiPickerChange"
bindcolumnchange="bindMultiPickerColumnChange"
value="{{multiIndex}}"
range="{{multiArray}}"
>
時間
來源:https://blog.csdn.net/weixin_41887529/article/details/88865472