import wx from 'weixin-js-sdk';
1.在vue文件的mounted中初始化参数
wx.config({
debug: false, // 开启调试模式,
appId: res.data.appId, // 必填,公众号的唯一标识
timestamp: res.data.timeStamp, // 必填,生成签名的时间戳
nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
signature: res.data.signature, // 必填,签名
jsApiList: ['onMenuShareAppMessage'],
openTagList: ['wx-open-launch-weapp'] // 可选,需要使用的开放标签列表
});
2.vue的template中引入
<wx-open-launch-weapp
id="launch-weapp1"
:username="gh_xxxx"
:path="xxxx"
>
<script type="text/wxtag-template">
<span style="display: inline-block;height: 24px;line-height: 24px; " @click="gotoCashPage">跳到小程序</span>