1、bindblur失焦事件
<textarea name="input-content" bindblur='getTextAreaContent'></textarea>
getTextAreaContent: function(event) {
that.data.content = event.detail.value;
console.log(event.detail.value)
},
2、trim() 方法 去除字符串的头尾空格:
3、小程序开发 页面跳转传递的id参数怎么使用?
微信小程序 怎样把id传给另外一个页面
wx.navigateTo({
url: 'test?id=1'
})
//test.js
Page({
onLoad: function(option){
console.log(option.id)
}
})
4、点击按钮获取输入框文字
bindinput,bindtap,bindblur执行顺序问题
tip: textarea 的 blur 事件会晚于页面上的 tap事件,如果需要在 button 的点击事件获取 textarea,可以使用 form 的 bindsubmit。