收藏
回答

【评价组件】的插件文档中的名字肯定是写错了?

先说结果,能使用的插件名称:

wxacommentplugin


再来看文档:

1、评价插件文档: https://mp.weixin.qq.com/wxopen/plugindevdoc?appid=wx82e6ae1175f264fa&token=824813413&lang=zh_CN

为了方便直接截图显示:

2、然后我们在看一下官方文档-平台能力-行业能力: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/guarantee/comment-plugin.html

一样取截图:

对比一下两张图中插件名称:

wxacommentplugin

wxatradecommentplugin // 交易类型的会使用这种??? 暂时不清楚,有知道的评论告知


插件的provide:

wx82e6ae1175f264fa


经过实际开发调试确定以下为正确使用方式:

      "plugins": {
        "wxacommentplugin": {
          "version": "latest",
          "provider": "wx82e6ae1175f264fa"
        }
      }


const plugin = requirePlugin('wxacommentplugin')
Page({
  // 官方评价组件
  evaluate() {
    plugin.openComment({
      // wx_pay_id: '4200001729202306024807578', // 交易评价类账号选填
      success: (res) => {
        console.log('plugin.openComment success', res)
      },
      fail: (res) => {
        console.log('plugin.openComment fail', res)
      }
    })
  }
})


回答关注问题邀请回答
收藏

1 个回答

  • Hlxuan.
    Hlxuan.
    2023-12-20

    那个插件引用名由使用者自定义的,用哪个都可以。文档应该是官方没同步吧。

    只要这里你在 app.json 里面声明插件引用名和调用插件接口时的名字一样就能正常使用的。

    2023-12-20
    有用
    回复 1
    • 鎏嫣宫守护
      鎏嫣宫守护
      2023-12-20
      插件自定义名称正解。
      2023-12-20
      回复
登录 后发表内容