宝哥软件园

微信小程序时间选择插件使用详解

编辑:宝哥软件园 来源:互联网 时间:2021-08-28

微信小程序时间选择插件-弹出选择,供大家参考,具体内容如下

页面结构

modal class=' modal ' hidden=' { { flag } } ' no-cancel bind confirm=' getTime ' confirm text='确定view class=' modal-content ' view class=' time _ screens ' view style=' text-align : center;颜色: # 45 BCE 8英寸{年} }-{ {月} }-{ {日} } { {小时} } : { {分钟} }/view view view style=' border-top :1 px solid # 45 BCE 8;height :25 px font-size :14 px;view class='time-title '年/view view class='time-title '月/view view class='time-title '日/view view class='time-title '时/view view class='time-title '分/view/view picker-view indicator-style=' height : 50px;style=' width : 100%;height : 300 px value=' { { value } } ' bind change=' bind change ' picker-view-column class=' picker-text ' view wx : for=' { { years } } ' style=' line-height : 50px ' { item } }/view/picker-view-column picker-view-column class=' picker-text ' view wx 3: for=' { { months } } ' style=' line-height : 550

常量日期=新日期()常量年=[]常量月=[]常量日=[]常量小时=[]常量分钟=[]var thisMon=Date。getmonths();var this day=date。getdate();var this hours=date。gethours();var this MINUTES=date。GetMINUTES();用于(让i=2017I=日期。get full year()1;i ) { years.push(i)} for(让I=日期。getmonth();I=11I){ var k=I;if(0=I I 9){ k=' 0 '(I 1);} else { k=(I ^ 1);}个月。push(k)} if(0=这个mon这个mon 9){这个mon=' 0 '(这个mon 1);} else { this mon=(this mon 1);} if(0=本日本日10){本日=' 0 '本日;} var total day=mGetDate(date。getfullyear()、本周一);用于(设I=1;I=31I){ var k=I;if(0=I I 10){ k=' 0 ' I }天。push(k)} for(让I=0;I=23I){ var k=I;if(0=I I 10){ k=' 0 ' I }小时。push(k)} for(让I=0;I=59I){ var k=I;if (0=i i 10) { k='0' i }分钟。push(k)}函数mGetDate(年,月){ var d=新日期(年,月,0);返回d . GetDate();} var app=GetApp();var API=app。全球数据。原料药;页面({ /** *页面的初始数据*/data : { checktime : date。getfull year()'-'这个星期一'-'今天' '这个小时' : '这个分钟,///-时间控件参数flag: true,years:year: date.getFullYear(),month : month : this mon,days: days,day: thisDay,value: [1,thisMon - 1,thisDay - 1,0,0],hours: hours,month : this,minutes 3360,minutes:},showModel: },getTime:函数(e){ var time=this。数据。年份-这个。数据。“月”——这个。数据。这一天。数据。小时。数据。分钟这个。setdata({ flag : true,check time : times });},bindChange:函数{ const val=e . detail。重视这个。设置数据({ year : this。数据。年[val[0]],月:本。数据。月:[val[1]],日: this.data.days[val[2]],小时: this。数据。小时[val[3]],分钟3:这。数据。分钟[val[4]],}) var totalDay=mGetDate(这.var变更日期=[];用于(设I=1;I=total dayi){ var k=I;if(0=I I 10){ k=' 0 ' I }更改日期。推(k)这个。setdata({ days : change date })},})css:kouviewList {底色: # F7F 7;}.kou view { height :170 pxmargin-top :5 px;}.kou view { height :150 pxmargin-top :5 px;}.时间标题{ float:left宽度:20%;文本对齐:居中;color:#45BCE8} .picker-text { text-align : center;}以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。

更多资讯
游戏推荐
更多+