},//文本框失去焦点事件bindInputblur:function(e){// console.log(e.detail.value)this.data.inputValue= e.detail.value},//发送弹幕内容bindSendDanmu :function(e){//设置弹幕颜色varcolor=""if(this.data.isRandomColor){//随机颜色color =this.getRandomColor() }else{ color =this.data.numberColor...
为文本输入框朱家bindinput属性,用于获取弹幕文本内容; 为按钮增加bindtap属性,用于触发点击事件; 在js的data中加入变量danmuTxt: ‘’ 用于记录得到的弹幕文本 编写两个函数 此时小程序里可以发送红色的弹幕: 可以为弹幕的颜色进行随机,编写一个函数产生随机颜色: 注意:此函数写在js文件的page外部 再修改发送弹幕的...