一、bindtap事件
在wxml文件里綁定:
<view class='wel-list' bindtap='TZdown'> <image src="/images/welcome_08.png"></image> <text>C語言資料下載</text> </view>
在js文件里相應:
Page({ TZdown: function () { wx.navigateTo({ url: '../download/download' }); }})二、bindinput事件
wxml文件:
<input type="number" placeholder="請輸入手機號" class="inp-holder" maxlength="11" bindinput="getPhone" /><input type="number" placeholder="請輸入驗證碼" class="inp-holder" maxlength="6" bindinput="getCode" />
js文件:
// 拿到手機號 getPhone: function (e) { var val = e.detail.value; this.setData({ telphone: val }); }, // 拿到驗證碼 getCode: function (e) { var val = e.detail.value; this.setData({ code: val }); },以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。
新聞熱點
疑難解答