微信小程序插件使用和更新

您所在的位置:网站首页 小程序发布后没有更新怎么办 微信小程序插件使用和更新

微信小程序插件使用和更新

2024-07-06 18:41| 来源: 网络整理| 查看: 265

以微信同声传译为例 一、使用 1,在微信公众平台:添加插件(设置-第三方设置-插件管理) 2.项目中 app.json中:

"sitemapLocation": "sitemap.json", "plugins": { "WechatSI": { "version": "0.2.3", "provider": "wx069ba97219f66d99" } }

新页面js文件中 添加

var plugin = requirePlugin('WechatSI') let manager = plugin.getRecordRecognitionManager()

事件

luyinstart() { manager.onStart = function (res) { console.log("成功开始录音识别", res) } manager.start({ duration: 30000, lang: "zh_CN" }) }, luyinend(e) { type = e.currentTarget.dataset.type console.log(type) manager.stop() var _this = this manager.onStop = function (res) { console.log("record file path", res.tempFilePath) console.log("result", res.result) for (var i = 0; i < _this.data.list.length; i++) { if (type == _this.data.list[i].name) { console.log(i) console.log(res.result) var up = "list[" + i + "].value" _this.setData({ [up]: res.result }) } } } },

新页面wxml文件中

需求描述


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3