微信小程序input框内容被发出后清空
1.首先设置在input里设置value
<viewclass="weui">
<inputclass="weui-input"placeholder="请输入弹幕"bindblur="bindInputBlur"value='{{inputValue}}'/></view>然后在Page({ })设置一个变量 inputValue=''Page({inputValue=''data:{},bindSendDanmu: function () {if (this.data.isRandomColor) {var color = getRandomColor();} else {var color = this.data.numberColor;}if (!this.data.inputValue) {this.videoContext.sendDanmu({text: this.inputValue,color: color})}this.setData({inputValue: ''//将data的inputValue清空});})要注意看value的位置小程序声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

