vue-wechat-util
v0.1.20
Published
vue 微信组件 授权、分享
Downloads
8
Readme
vue-wechat-util vue 微信组件
功能
- 分享
- 授权 : 配合本地存储使用,记录当前授权身份
使用方法
- 初始化
const wechat = new Wechat(
{
getAppInfoApi: 'http://wx-api.wqtsoft.com:3000/get-signature',
requestData: { billType: 1, appId: '可为空值,将从后端读取' },
apiList: [
'updateAppMessageShareData',
'updateTimelineShareData',
'onMenuShareWeibo'
],
debug: true
},
new RouterX(router, {
getAccountFromCode: (code, state) => {
// 获取到 微信授权码code后执行本地业务逻辑
console.log('getAccount from code,', code, ' state:', state);
return Promise.resolve('ok');
},
onGetAccount: account => {
console.log('get account,', account);
}
})
);
Vue.prototype.$wechat = wechat;
- 使用 wx
this.$wechat.init().then(()=>{
wx.chooseImage()
})