微信小程序实现提交input信息到后台的方法示例
本文实例讲述了微信小程序实现提交input信息到后台的方法。分享给大家供大家参考,具体如下:
wxml文件:
您的姓名 所属部门 联系电话 选择日期 {{date}} 开始时间 {{starttime}} 结束时间 {{endtime}} 提交
js代码:
varutil=require('../../utils/util.js')//引入微信自带的日期格式化 constapp=getApp() Page({ data:{ date:util.formatDate(newDate),//格式化日期 starttime:'9:00',//开始时间 endtime:'21:00',//结束时间 userName:'', userBranch:'', userTell:'' }, bindDateChange:function(e){ this.setData({ date:e.detail.value }) }, starttime:function(e){ this.setData({ starttime:e.detail.value }) }, endtime:function(e){ this.setData({ endtime:e.detail.value }) }, userNameInput:function(e){ //console.log(e.detail.value)设置用户名 this.setData({ userName:e.detail.value }) }, userBranchInput:function(e){ //设置部门 this.setData({ userBranch:e.detail.value }) }, userTellInput:function(e){ //设置电话 this.setData({ userTell:e.detail.value }) }, orderMeeting:function(){//提交input信息到后台 varuserName=this.data.userName; console.log(userName) varuserBranch=this.data.userBranch; console.log(userBranch) varuserTell=this.data.userTell; console.log(userTell) vardate=this.data.date; console.log(userTell) } })
希望本文所述对大家微信小程序开发有所帮助。