<wx-open-launch-weapp
id="launch-btn"
appid="wx0a5fb4923614e532"
username="gh_bd7186f7273b"
path="pages/tabbar/home/home.html"
<script type="text/wxtag-template">
<style>.btn {
width: 335px;
height: 45px;
line-height: 45px;
background: #707AFF;
border-radius: 22.5px;
margin-top: 40px;
font-size: 32px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
}</style>
<button class="btn">点击打开微信小程序</button>
</script>
</wx-open-launch-weapp>
<button @click="handleOpenApplet">点击打开微信小程序</button>
handleOpenApplet(){
// window.location.href = 'https://sourl.cn/s7ri77'
const urlEncoded = encodeURIComponent(window.location.href);
getSharingSign(urlEncoded).then((res)=>{
console.log(res, '返回的参数')
const { code, data:{appId,timestamp,nonceStr,signature} } = res;
if(code == 200){
const wx = this.wx;
wx.config({
debug: true,
appId: appId,
timestamp: timestamp,
nonceStr: nonceStr,
signature: signature,
jsApiList: ['onMenuShareTimeline'], // 必填,需要使用的 JS 接口列表
openTagList: ['wx-open-launch-weapp'] // 可选,需要使用的开放标签列表,例如['wx-open-launch-app']
});
var btn = document.getElementById('launch-btn');
btn.addEventListener('ready', function (e) {
console.log('ready');
});
btn.addEventListener('launch', function (e) {
console.log('sssssss');
});
wx.ready(function(){
console.log('成功')
})
wx.error(function(res){
console.log(res,'dsadsadsadsad')
})
}
})
}
wx.ready打印出来了,但是wx.error也打印出来了报错config:invalid signature 有知道怎么解决的大佬吗
1 个回复
DCloud_UNI_WZF
非框架问题,参考 微信开放文档 检查配置或微信开发者社区反馈