Page({
data: {
motto: 'Hello World',
url:"",
httpUrl:"https://域名/项目名称/",
webViewSrc:'',
navTitle:'',
PinJie:'',
userInfo: {
avatarUrl: defaultAvatarUrl,
nickName: '',
},
hasUserInfo: false,
canIUseGetUserProfile: wx.canIUse('getUserProfile'),
canIUseNicknameComp: wx.canIUse('input.type.nickname'),
},
onLoad(option){
var thatData= this.data;
thatData.url=option.url;
thatData.navTitle=option.title;
if(option&&option.url){
for (let key in option) {
if(key!="url"&&key!="title"){
thatData.PinJie+="&"+key+"="+option[key];
}
}
}
},
onShow(){
var that=this;
var thatData=this.data;
this.data.webViewSrc="";
if(thatData.url){
that.setData({
webViewSrc: thatData.httpUrl+thatData.url+"?v="+new Date().getTime()+thatData.PinJie
});
console.log(getCurrentPages());
}else{
that.setData({
webViewSrc: thatData.httpUrl+"StudentUser/Login"
});
}
},
methods: {
bindViewTap() {
wx.navigateTo({
url: '../logs/logs'
})
},
},
loadSuccess:function(e){
wx.setNavigationBarTitle({
title: this.data.navTitle
})
},
receiveMessage:function(e){
if(this.data.url=="StudentHome/AddPlan"){
if(e.detail.data){
var SubjectID=e.detail.data[0].SubjectID;
var SubjectName=e.detail.data[0].SubjectName;
this.data.PinJie="&SubjectID="+SubjectID+"&SubjectName="+SubjectName;
}
}
},
})
H5提供下呢
<div>
<a>
<i class="bi bi-clipboard2-pulse" style="font-size: 1.7rem; color: #A6A6B8;"></i>
</a>
</div>
<div style="margin-top: -5px;">
<h5 style="color:#A6A6B8; font-size: 10px;"><a>学习情报</a></h5>
</div>
</div>
<div class="col" onclick="wx.miniProgram.reLaunch({ url: 'index?url=StudentHome/Index&title=首页'})">
<div>
<a>
<i class="bi bi-houses-fill" style="font-size: 1.7rem; color:#10C6BA;"></i>
</a>
</div>
<div style="margin-top: -5px;">
<h5 style="color: #10C6BA; font-size: 10px;"><a>首页</a></h5>
</div>
</div>
<div class="col" onclick="wx.miniProgram.reLaunch({ url: 'index?url=StudentUser/Index&title=个人设置'})">
<div>
<a>
<i class="bi bi-person-fill" style="font-size: 1.7rem;color: #A6A6B8;"></i><br />
</a>
</div>
<div style="margin-top: -5px;">
<h5 style="color: #A6A6B8;font-size: 10px;"><a>我的</a></h5>
</div>
</div>
</div>
ios机型会出现,左滑页面重复的问题,请问怎么解决
//直接在h5页面拦截后退事件,比较笨拙 就不会出现很多个 重复的页面 //虽然解决了,但是需要在每个h5页面都加上后退的逻辑 //我不理解到底是小程序的页面栈在控制还是webview的缓存在控制。谁能解答我的难题吗? (function () { if (window.history && window.history.pushState) { window.addEventListener('popstate', function () { if (1 == 1) { //直接清空 wx.miniProgram.reLaunch({ url: "index?url=StudentHome/Index&title=首页" }) //wx.miniProgram.closeWindow();这个感觉没用 } }); window.history.pushState('forward', null, ''); window.history.forward(1); } })();
感觉是多次连续点击跳转了多次,建议添加连点检测拦截
必现吗?是不是手机比较卡
如果手机比较卡的时候,上个页面连续多次点击跳转,会打开很多个目标页面。