vuejs 项目引入微信jssdk
一、导入依赖包
npm i -S weixin-js-sdk二、前端页面使用
import wx from ‘weixin-js-sdk‘
export default {
  created() {
    let param = {
      debug: true,
      url: ‘http://localhost:8081/productgroups‘,
      jsApiList: [
        ‘chooseWXPay‘,
        ‘checkJsApi‘
      ]
    };
    wechatlib.queryJsConfig(param, (err, obj) => {
      if (err) {
        return this.$toast(err);
      }
      console.log(‘jsconfig ‘, obj);
      wx.config(obj);
      wx.ready(() => {
        console.log(‘wx.ready‘);
      });
      wx.error(function (res) {
        console.log(‘wx err‘, res);
        //可以更新签名
      });
    });
  }
}三、wechatlib中获取jsconfig的方法
queryJsConfig(param, callback)
{
  networklib.post(‘/wechat/jsconfig‘, param).then(obj => {
    callback(null, obj);
  }).catch(err => {
    callback(err)
  });
}文章来自:https://www.cnblogs.com/liangfengbo/p/9117730.html