收藏
回答

wx-open-launch-app在IOS中不显示

问题类型 操作系统 操作系统版本 手机型号 微信版本
Bug iOS IOS 16.3 iPhone15 8.0.69
// 场景: 在ios微信浏览器中打开同一个h5链接,https://www.mjits.cn/?InvitaCode=948&url=home#/,
// 问题: 点击链接打开正常显示wx-open-launch-app标签,扫码打开链接不显示wx-open-launch-app标签


<wx-open-launch-app id="launch-btn" :appid="common.launchAppId" :extinfo="id" style='position: fixed;bottom: 30px;left: 50%;width: 100vw;transform: translate(-50%);z-index: 999;'>
			<script type="text/wxtag-template">
				<style>
						   .openApp{
						          background: linear-gradient(103deg, #FF9A14 0%, #FF5410 100%);
								  border:none;
								  width:60%;
								  height:45px;
								  display:block;
								  color:#FFFFFF;
								  font-size: 14px !important;
								  letter-spacing: 1px;
								  border-radius: 328px;
								  margin: auto;
								 }
						</style>
					 <button class="openApp"> App内打开 </button>
				</script>
		</wx-open-launch-app>

                mounted() {
			setTimeout(() => {
				var btn = document.getElementById('launch-btn');
				btn.addEventListener('launch', (e)=>{
					console.log('success成功');
				});
				btn.addEventListener('error', (e) => {
					console.log('fail', e.detail);
					uni.showModal({
						title: '系统消息',
						content: '您的手机未找到当前应用,是否去下载?',
						success: (res) => {
							if (res.confirm) {
								// var u = navigator.userAgent;
								// let isiOS = navigator.userAgent.match(/(iPhone|iPod|iPad);?/i);
								// if (isiOS){
								// 	window.location =this.common.iosDownUrl // 可以在苹果开发者中心找对应APP的链接
								// } else{
									this.modalStatus = true
									return
								// }
									
							}else{
								uni.showToast({
									icon:'none',
									title:'用户点击取消'
								})
							}
						}
					});
				});
			}, 1000)
		},
回答关注问题邀请回答
收藏

2 个回答

  • 智能回答 智能回答 本次回答由AI生成
    02-25
    有用 1
  • 非衣
    非衣
    03-02
    wxjs() {
    		let signLink = window.location.href.split("#")[0] || window.location.href;
    		let data = {
    			module: 'WechatShare',
    			action: 'getSignPackage',
    			prms: {
    				url: signLink
    			}
    		}
    		common.request(data, this.wxjsCb.bind(this))
    	},
    	wxjsCb(res) {
    		if (res.code ==0) {
    			appid = res.data.appId
    			common.gzhAppId = appid
    			wx.config({
    				debug: false, //测试时候用true 能看见wx.config的状态是否是config:ok
    				appId: res.data.appId, // 必填,公众号的唯一标识(公众号的APPid)
    				timestamp: res.data.timestamp, // 必填,生成签名的时间戳
    				nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
    				signature: res.data.signature, // 必填,签名
    				jsApiList: ['onMenuShareTimeline','chooseWXPay'], // 必填,随意一个接口即可  
    				openTagList: ['wx-open-launch-app'],
    			});
    			wx.ready((e) => {
    				// alert('wxsdk加载完成')
    				console.log('初始化完成', e)
    			})
    			wx.error((res) => {
    				console.log('初始化错误', res);
    			})
    		}
    		
    	}
    
    03-02
    有用
    回复
登录 后发表内容