加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

小程序的事件 bindtap bindinput

发布时间:2020-12-14 05:15:50 所属栏目:大数据 来源:网络整理
导读:一、bindtap事件 在wxml文件里绑定: view class=‘wel-list‘ bindtap=‘TZdown‘ image src="/images/welcome_08.png"/image textC语言资料下载/text /view ? 在js文件里相应: Page({ TZdown: function () { wx.navigateTo({ url: ‘../download/download

一、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
        });
    },

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

<input type="number" placeholder="请输入手机号" class="inp-holder" maxlength="11" bindinput="getPhone" />

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读