xu-li / cordova-plugin-wechat

A cordova plugin, a JS version of Wechat SDK
1.22k stars 509 forks source link

capacitor 如何配置? #606

Open mfyang opened 2 years ago

mfyang commented 2 years ago

根据文档,cordova是安装的时候直接在命令行配置wechat app id。

有哪位大侠指教一下,capacitor用npm安装,npx cap sync。之后在哪里配置wechat app id和universal link呢?

yuangu commented 2 years ago
  1. android在res/xml 下有一个config.xml文件。在这里面写上。
<preference name="WECHATAPPID" value="您的appid"/>
image
  1. 同理,在ios下面也有一个config.xml。如l图所示。
image

另:实测在capacitor里可以使用preference配置,但是 由于npx cap sync不会同步plugin.xml 里的preference,每次 sync后都需要手动修改,造成比较大的麻烦,不晓得capacitor下为啥不能同步cordova的preference配置?

mfyang commented 2 years ago

好棒,谢谢!

Ong26 commented 2 years ago

@mfyang 你能在ionic v6做到微信登录吗?

mfyang commented 2 years ago

没试过ionic,但是quasar在android下没问题了。具体就是上面二楼的回复,有效。

luoliang222 commented 2 years ago

在capacitor.config.json中新增插件属性: "cordova": { "preferences": { "WECHATAPPID": "wxxxxxxxxxxxx" } }