const plugin = requirePlugin("WechatSI"); let manager = plugin.getRecordRecognitionManager(); // Events const INPUT_COMPLETE = "inputComplete" // io/voice.js Component({ /** * Component properties */ properties: { lang: { type: String, value: 'zh_CN' } }, created: function() { console.log('created') let that = this manager.onStart = function(res) { console.log("manager.Start", res) that.triggerEvent(INPUT_COMPLETE, 'start') } // 识别结束事件 manager.onStop = function(res) { console.log("manager.onStop") } manager.onError = function(res) { console.log('manager.onError') } }, /** * Component initial data */ data: { }, /** * Component methods */ methods: { recordStart() { let lang = this.properties.lang manager.start({ lang, }) }, recordEnd() { console.log('recordEnd') manager.stop() } } }) |
自定义了一个语音输入的组件,在开发工具中测试时发现可以看到“recordEnd
”消息,不能看到"manager.onStop"信息。这里我还遗漏了某些设置吗?如果没有。manager.onStop为什么不触发呢?