H5跳转小程序,签名通过点击跳转无反应?
wx-open-launch-weapp 跳转小程序点击无反应,报错信息也没有回来。
<div id="wechat-web-container" style="width: 100%;height: 100px;display: flex; align-items: center;justify-content: center;">
<wx-open-launch-weapp id="launch-btn" username="小程序ID" path="/pages/index/index.html" [@error](/user/error)="handError"
[@launch](/user/launch)="handleLaunchFn">
<template>
<style>
.wx-btn {
width: 100px !important;
height: 44px !important;
line-height: 44px !important;
font-size: 16px !important;
color: \#ffffff !important;
background-color: \#f94048 !important;
text-align: center !important;
}
</style>
<button class="wx-btn" style="border: 1px solid red !important;" [@click](/user/click)="handletest">跳转小程序</button>
</template>
</wx-open-launch-weapp>
</div>
验签成功 增加
that.$wx.ready(res => {
console.log(res);
that.$nextTick(() => {
let btn = document.getElementById('launch-btn');
btn.addEventListener('launch', e => {
console.log('success');
alert('success');
});
btn.addEventListener('error', e => {
alert('小程序打开失败');
console.log('fail', e.detail);
alert('fail', e.detail);
});
});
});
回调函数
handleError(e) {
console.log('fail', e.detail);
alert('fail', e.detail);
},
handleLaunchFn(e) {
console.log('success');
alert('success');
},
handletest() {
console.log('handletest');
alert('handletest');
}
3 回复