跳转小程序:wx-open-launch-weapp
用于页面中提供一个可跳转指定小程序的按钮。使用此标签后,用户需在网页内点击标签按钮方可跳转小程序。H5通过开放标签打开小程序的场景值为1167。
开放对象
已认证的服务号,服务号绑定“JS接口安全域名”下的网页可使用此标签跳转任意合法合规的小程序。
已认证的非个人主体的小程序,使用小程序云开发的静态网站托管绑定的域名下的网页,可以使用此标签跳转任意合法合规的小程序。
目前采用已认证服务号的方案,在微信内置浏览器是能正常跑通流程,拉起小程序的,但是复制链接到默认浏览器打开,wx-open-launch-weapp没有加载出来,这是正常的吗?
你好,提供下测试链接
appId: res.data.data.appid,
timestamp: res.data.data.timestamp,
nonceStr: res.data.data.noncestr,
signature: res.data.data.signature,
jsApiList: ["scanQRCode"],
openTagList: ["wx-open-launch-weapp"], // 可选,需要使用的开放标签列表,例如[‘wx-open-launch-weapp’]
});
wx.error(function (res) {
console.log(res);
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
});
wx.ready(function () {
console.log("wx ready");
});
}
});
},
},
};
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
链接不方便,但是主要代码就是这样(vue),通过服务器获取到签名后配置wx.config, 在微信内置浏览器是正常的,会显示打开小程序的按钮,复制到默认浏览器没有了
<script>
import wx from "weixin-js-sdk";
export default {
name: "App",
components: {},
mounted: function () {
console.group("------mounted 挂载结束状态------");
this.onClickOpens()
},
methods: {
onClickOpens() {
console.log("url: " + window.location.href);
this.$http({
method: "POST",
url: "/http/getSignature",
data: {
url: window.location.href,
},
}).then(function (res) {
console.log(res.data);
if (res.data.code == 200) {
console.log(res.data.appid);
wx.config({
debug: true,
appId: res.data.data.appid,
timestamp: res.data.data.timestamp,
nonceStr: res.data.data.noncestr,
signature: res.data.data.signature,
jsApiList: ["scanQRCode"],
openTagList: ["wx-open-launch-weapp"], // 可选,需要使用的开放标签列表,例如[‘wx-open-launch-weapp’]
});
wx.error(function (res) {
console.log(res);
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
});
wx.ready(function () {
console.log("wx ready");
});
}
});
},
},