jweixin.js 1.8 KB

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