wx-open-launch-weapp标签不显示按钮的问题?
请教各位大佬,wx-open-launch-weapp标签不显示按钮咋解决,微信的config也返回了ok, 公众号也是认证的服务,也配置了js安全域名和接口白名单,但是标签里的按钮怎么也不展示,手机和浏览器都不行,发到生产上也不行
2 回复
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js "></script>
<script src="https://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
</head>
<body>
<div id="weChatApp" style="width:3rem;">
<div>1111111</div>
<wx-open-launch-weapp id='wxbutton' username='gh_37dd9c33de04' path='/pages/index/index.html'>
<template>
<button >跳转小程序</button>
</template>
</wx-open-launch-weapp>
</div>
<div id="weApC" style="width:3rem">
<div>2222</div>
<wx-open-launch-weapp id="launch-btn" username="gh_7c2bc00a6bf8" path="/pages/index/index.html">
<script type="text/wxtag-template">
<style>
.btn {
width: 375px;
height: 50px;
font-size: 16px;
}
</style>
<button class="btn">打开小程序</button>
</script>
</wx-open-launch-weapp>
</div>
</body>
<script>
$(document).ready(function() {
$.ajax({
//请求方式
type: "POST",
//请求的媒体类型
contentType: "application/json",
//请求地址
//https://wxxapp.chinaunicom.cn/touch-qrcode_gray/secondVerify/initWxConfig
url: 'initWxConfig',
data: JSON.stringify({url: window.location.href.split('#')[0]}),
dataType:"html",
global: true,
success:function (data) {
data = JSON.parse(data);
if(data.respCode == "0000"){
console.log("---11--"+JSON.stringify(res));
var res = data.respData;
wx.config({
debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印
appId: res.appId, // 必填,公众号的唯一标识
timestamp: res.timestamp, // 必填,生成签名的时间戳
nonceStr: res.nonceStr, // 必填,生成签名的随机串
signature: res.signature,// 必填,签名
// /
jsApiList: ['checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'hideMenuItems',
'showMenuItems',
'hideAllNonBaseMenuItem',
'showAllNonBaseMenuItem',
'translateVoice',
'startRecord',
'stopRecord',
'onRecordEnd',
'playVoice',
'pauseVoice',
'stopVoice',
'uploadVoice',
'downloadVoice',
'chooseImage',
'previewImage',
'uploadImage',
'downloadImage',
'getNetworkType',
'openLocation',
'getLocation',
'hideOptionMenu',
'showOptionMenu',
'closeWindow',
'scanQRCode',
'chooseWXPay',
'openProductSpecificView',
'addCard',
'chooseCard',
'openCard'
], // 必填,需要使用的JS接口列表
openTagList: ['wx-open-launch-weapp','wx-open-launch-app'] // 可选,需要使用的开放标签列表,例如['wx-open-launch-app']
});
}else{
alert(data.respMsg)
}
wx.error(function (res) {
alert("wx.error----"+JSON.stringify(res));
})
//初始化配置之后调用
wx.ready(function () {
$.walk.tip("launch")
alert("launch");
});
},
error: function(e) {
alert("eeeee"+e.status + "--------" + e.responseText)
}
})
})
</script>
</body>
</html>