jweixin.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import wx from 'jweixin-module';
  2. // console.log("🚀 ~ file: jweixin.js ~ line 2 ~ wx", wx)
  3. // import Vue from 'vue';
  4. // import { getConfig } from '~/api/wx/index.js';
  5. export default function (c, i) {
  6. // Vue.config.optionMergeStrategies.wxReady = function (toVal, fromVal) {
  7. // console.log(
  8. // '🚀 ~ file: jweixin.js ~ line 10 ~ toVal, fromVal',
  9. // toVal,
  10. // fromVal,
  11. // );
  12. // // 返回合并后的值
  13. // return [];
  14. // };
  15. // const { app } = c;
  16. i('wx', wx);
  17. // app.router.afterEach(async (to, from) => {
  18. // // 微信js签名注册
  19. // try {
  20. // // if (to.matched[0].instances.default) {
  21. // // to.matched[0].instances.default.$emit('wxReady');
  22. // // } else {
  23. // // console.log(to.matched[0].components.default);
  24. // // // to.matched[0].components.default.mixin({
  25. // // // mounted() {
  26. // // // console.log('wxReady');
  27. // // // this.$emit('wxReady');
  28. // // // },
  29. // // // });
  30. // // }
  31. // // const res = await getConfig(c, location.href);
  32. // // await new Promise((resolve, reject) => {
  33. // // wx.config({
  34. // // debug: true, // 开启调试模式,调用的所有 api 的返回值会在客户端 alert 出来,若要查看传入的参数,可以在 pc 端打开,参数信息会通过 log 打出,仅在 pc 端时才会打印。
  35. // // appId: res.data.appId, // 必填,公众号的唯一标识
  36. // // timestamp: res.data.timestamp, // 必填,生成签名的时间戳
  37. // // nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
  38. // // signature: res.data.signature, // 必填,签名
  39. // // jsApiList: [], // 必填,需要使用的 JS 接口列表
  40. // // });
  41. // // wx.ready(resolve);
  42. // // wx.error(reject);
  43. // // });
  44. // } catch (error) {}
  45. // });
  46. }