var plugin = requirePlugin("WechatSI")
let manager = plugin.getRecordRecognitionManager()
manager.onStop = function (res) {
wx.showToast({
title: res.result,
})
this.setData({yuyin:res.result})
this.wordYun()
}
所以和this相关的都是报错;错误提示:this.setData is not a function;也用var that=this测试,同样报错
前面加一个let that= this,后面用that调用
用事件触发试试吧。
manager.onStop = function (res) { wx.showToast({ title: res.result, }) this.triggerEvent('onMyEvent', { yuyin : res.result } ) this.wordYun() } function onMyEvent(event) { var yuyin = event.detail.yuyin this.setData({ yuyin:yuyin }) }