码迷,mamicode.com
首页 > 微信 > 详细

小程序的事件 bindtap bindinput

时间:2019-01-11 00:04:35      阅读:1231      评论:0      收藏:0      [点我收藏+]

标签:spl   mic   tag   下载   back   tap   function   white   UNC   

一、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" />

小程序的事件 bindtap bindinput

标签:spl   mic   tag   下载   back   tap   function   white   UNC   

原文地址:https://www.cnblogs.com/jie888/p/10253178.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!