小程序事件绑定
小程序中的事件有哪些?
tap:点击事件;
longtap:长按事件;
touchstart:触摸开始;
touchend:触摸结束;
touchcansce:取消触摸;
如何绑定事件?
bind绑定;
catch绑定;(能阻止事件冒泡)
【代码实例】
wxml文件
<button bindtap="x1">延迟执行</button>
小程序获取表单元素的值
1、使用vant weapp组件
<van-field required placeholder="手机号" label="手机号" value="" error-message="{{mobile_msg}}" left-icon="contact" bindinput="mobile_input"/>
mobile_input:function(e){
this.setData({mobile:e.detail});
}2、使用微信原生组件
<van-field required placeholder="手机号" label="手机号" value="" error-message="{{mobile_msg}}" left-icon="contact" bind:input="mobile_input"/>
mobile_input:function(e){
this.setData({mobile:e.detail.value});
}
小程序中,全局变量和缓存的区别?
小程序 延迟执行 定时执行
小程序历史页面
这个暂时不会