touch-select
通用 react vue 原生JavaScript
html
时间选择 城市选择
js
; ; //这是插件内置的省市区数据 data.js 修改 或者自行调用接口获取 ; /** *@生成选择时间 *@param {string}时间戳字符串 *@return JSON *@author 应进兵 */ { var time_data= mo_day_m: time: ; var temp=server_time ? server_time : ; var temp2=temp+'/'++'/'++' '+temp+':00:00'; var temp_hour=; var now_hour=temp_hour; time_datanow_hour=now_hour; time_datanow_min=now_hour; forvar hours=0;hours<48;hours++ time_datanow_min+=30; iftime_datanow_min===60 iftime_datanow_hour<23 time_datanow_hour+=1; else time_datanow_hour=0 time_datanow_min=0 time_datatime; var shijian=Date; forvar time_day=0;time_day<99;time_day++ var temp3=shijian; time_datamo_day_m; shijian+=3600*24*1000 return time_data }; //返回中文星期几 { }; { var touchSelect_ob= time1:null ; { return document } //获取时间对象 var time_data=this; //拼接年月日html var dat= time:'' day:'' ; forvar wws=0;wws<time_datamo_day_mlength;wws++ var conts_time=wws===0 ? '今天' :time_datamo_day_mwwsmonth +'月'+time_datamo_day_mwwsday+' '+ this; datday+='<li data-name="day" data-auto="data-自定义参数" data-value='+time_datamo_day_mwwsyear+'/'+time_datamo_day_mwwsmonth+'/'+time_datamo_day_mwwsday+'>'+conts_time+'</li>' forvar wwss=0;wwss<time_datatimelength ;wwss++ dattime+='<li data-name="time" data-auto="data-自定义参数" data-value='+time_datatimewwsshour+':'+time_datatimewwssmin+'>'+time_datatimewwsshour+':'+time_datatimewwssmin+'</li>' /** * 调用时间选择插件 * param { * click_id:'string' 触发id * render:function() * touch_end_fn:function() * select_val:function() * } * touchSelect_ob.time1.get_all_value() //获取所选值 * @author 应进兵 * */ //新建实例 touchSelect_obtime1 = ; //设置默认选中项 touchSelect_obtime1select_arr=01; //初始化实例 touchSelect_obtime1 }; { var touchSelect_ob={}; var ct=city_datadata; { return document } //新建实例 touchSelect_obtime2 = ; //设置默认位置 touchSelect_obtime2select_arr=000; //初始化 touchSelect_obtime2; };