开放标签 wx-open-launch-weapp 为什么无法打开对应的path,每次都会跳转到首页,
求问求解决!!已知path是存在且有效的
public pathTwo = 'pages/setting/index.html' // 非首页 无法跳转到 想跳转到商品详情页有参数,但是目前不带参数的非首页都无法跳转
public getHtml () {
const script = document.createElement('script');
script.type = 'text/wxtag-template';
script.text = '<button class="btn blue mt1" style="height: 400px;width: 400px;">跳转小程序</button>';
this.wxHtml =
`<wx-open-launch-weapp style="height: 400px;width: 400px;" id="launch-btn" username="gh_xxxxxx" :path="${this.pathTwo}">
${script.outerHTML}
</wx-open-launch-weapp>`;
this.$nextTick(() => {
this.tolinkMiniapp();
});
}
public tolinkMiniapp () {
const btn = document.getElementById('launch-btn');
btn.addEventListener('launch', function (e) {
console.log('success', e);
});
btn.addEventListener('error', function (e:any) {
console.log('fail', e.detail);
});
}
// html
<div v-html="wxHtml" />
解决了,在config的时候,jsapilist 不可以为空
这里为什么要加冒号
this.wxHtml =
`<wx-open-launch-weapp style="height: 400px;width: 400px;" id="launch-btn" username="gh_xxxxxx" path="pages/setting/index">
${script.outerHTML}
</wx-open-launch-weapp>`;
你把相关代码贴出来,大家才能帮你看哪里有问题