fix wx nav

This commit is contained in:
yuexin 2019-12-03 15:17:21 +08:00
parent 6647a3910c
commit f31e949faa
4 changed files with 36 additions and 8 deletions

View File

@ -50,9 +50,37 @@ export default {
}, 0)
this.$emit('clickItem', { _id: id })
requestUtil.postData('/view', { _id: id })
wx.reLaunch({
url: `/pages/details/main?_id=${id}`
})
let objs = getCurrentPages();
console.log('wx.getCurrentPages');
console.log(objs);
let n = 0;
let bfind = false;
for(let i = objs.length - 1; i >=0; i--){
let obj = objs[i];
if(obj.route != 'pages/details/main'){
n++;
continue;
}
if(obj.options && obj.options._id == id){
bfind = true;
break;
}
n++;
}
if(bfind){
if(n == 0){
wx.pageScrollTo({scrollTop: 0});
}else{
wx.navigateBack({
delta: n
})
}
}else{
wx.navigateTo({
url: `/pages/details/main?_id=${id}`
})
}
}
}
}

View File

@ -118,7 +118,7 @@ export default {
margin: 0 auto;
padding: 60rpx 32rpx;
background-color: #fffdf5;
border: 4px solid #ffdc34;
border: 8rpx solid #ffdc34;
}
.title {
position: absolute;
@ -197,7 +197,7 @@ export default {
margin-top: 30rpx;
.list {
background-color: #fff;
border: 4rpx solid #ffdc34;
border: 6rpx solid #ffdc34;
.list-hd {
display: flex;
justify-content: space-between;

View File

@ -177,7 +177,7 @@ export default {
})
},
goSearch() {
wx.redirectTo({
wx.navigateTo({
url: `/pages/search/main`
})
},
@ -226,7 +226,7 @@ export default {
margin: 0 auto;
padding: 90rpx 32rpx 90rpx;
background-color: #fffdf5;
border: 4px solid #ffdc34;
border: 8rpx solid #ffdc34;
}
.title {
.l {

View File

@ -337,7 +337,7 @@ export default {
margin-top: 30rpx;
.list {
background-color: #fff;
border: 4rpx solid #ffdc34;
border: 6rpx solid #ffdc34;
.list-hd {
display: flex;
justify-content: space-between;