web-retail-h5/components/backIcon.vue

67 lines
1.4 KiB
Vue

<!--
* @Descripttion:
* @version:
* @Author: kBank
* @Date: 2022-11-21 16:46:09
-->
<template>
<view class="navBar"
@tap="toBack">
<u-icon name="arrow-left"
size="14"
color="#333"></u-icon>
</view>
</template>
<script>
export default {
name: 'navBar',
props:['diff'],
data() {
return {}
},
mounted() {},
methods: {
toBack() {
let pages = getCurrentPages()
let prevPage = pages[pages.length - 1]
// 分享进来
if (prevPage.route == 'pages/index/goodsDetails/index') {
uni.switchTab({ url: '/pages/index/index' })
//海粉列表
} else {
if (this.diff == 0) {
uni.switchTab({ url: '/pages/specialArea/index' })
} else if (this.diff == 1) {
uni.switchTab({ url: '/pages/index/index' })
}else if (this.diff == 2) {
uni.navigateBack()
} else {
if(pages[pages.length - 2]&&pages[pages.length - 2].route){
uni.navigateBack()
}else{
uni.switchTab({ url: '/pages/index/index' })
}
// uni.navigateBack()
}
}
},
},
}
</script>
<style lang="scss" scoped>
.navBar {
position: fixed;
margin: 14rpx 24rpx;
z-index: 1000000000;
width: 28px;
height: 28px;
background: rgba(255, 255, 255, 0.7);
border-radius: 14px 14px 14px 14px;
display: flex;
justify-content: center;
align-items: center;
}
</style>