<view>
<!-- @onPostMessage="demo" -->
<web-view :src="url" v-if="token"></web-view>
</view>
export default {
data() {
return {
url:'',
token:''
}
},
onLoad(e) {
let a = e.url
// this.url = unescape(a)
this.url = 'https://tb.zhongkehuayu.net/map/map2.html?wxapp_id=2'
this.token=uni.getStorageSync('token');
wx.getSystemInfo({
success: res=>{
console.log(res)
let model = res.model;
if (/iphone\sx/i.test(model) || (/iphone/i.test(model) && /unknown/.test(model))|| /iphone\s11/i.test(model)||/iphone\s12/i.test(model)||/iphone\s13/i.test(model)){
this.url = this.url + '&iphone10=true';
}else{
this.url = this.url + '&iphone10=false';
}
}
})
},
onShow() {
this.token=uni.getStorageSync('token');
if(!this.token){
uni.showModal({
title: '提示',
content: '该功能需要登录进行,是否登录',
confirmText: '去登录',
success: function(res) {
if (res.confirm) {
_this.gourl('/pages/index/login')
} else if (res.cancel) {
uni.switchTab({
url: '/pages/index/index'
});
}
}
});
} else {
// this.getDetail();
// this.getStorage();
}
},
methods: {
// demo(e) {
// console.log(e)
// }
}
}
小程序tab-bar使用外部链接
最新推荐文章于 2023-07-27 14:52:19 发布