微信小程式例子——使用form表單獲取輸入框資料
阿新 • • 發佈:2019-01-03
1、效果展示
2、關鍵程式碼
index.wxml
{{tip}}{{userName}}{{psw}}index.js
Page({ data:{ // text:"這是一個頁面" tip:'', userName:'', psw:'' }, formBindsubmit:function(e){ if(e.detail.value.userName.length==0||e.detail.value.psw.length==0){ this.setData({ tip:'提示:使用者名稱和密碼不能為空!', userName:'', psw:'' }) }else{ this.setData({ tip:'', userName:'使用者名稱:'+e.detail.value.userName, psw:'密碼:'+e.detail.value.psw }) } }, formReset:function(){ this.setData({ tip:'', userName:'', psw:'' }) } })
3、原始碼獲取方式
百度雲連結:http://pan.baidu.com/s/1gfx8qWV
4、在獲取表單資料的過程中有遇到任何問題或者不明白的地方,歡迎新增我的微信進行諮詢,感謝您的支援!微訊號:FutureJet
5、覺得不錯請打賞,您的十分滿意是筆者的無限動力。