小程序基本技巧,动态监测input

动态监测input输入的值

wxml:
<input type='number' bindinput='change' placeholder="请输入" placeholder-class="placeholder" focus="true"></input>
focus 进入这个搜索页面后自动获取焦点,也就是进来后自动调出微信键盘光标不停的在搜索框里闪啊闪的。我在写focus的时候,把搜索框放在页面的下方,当从其他页面进入的时候,会自动定位到这里
js: change:function(r){ console.log(r.detail.value) this.setData({ key: r.detail.value }) },

猜你喜欢

转载自www.cnblogs.com/naturl/p/9492887.html
今日推荐