3
0
Fork 0
web-store-retail-h5/components/backIcon.vue

64 lines
1.4 KiB
Vue
Raw Normal View History

2025-03-23 09:29:40 +08:00
<!--
* @Descripttion:
* @version:
2025-03-23 09:29:40 +08:00
* @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>
2025-03-23 09:29:40 +08:00
</view>
</template>
<script>
export default {
name: 'navBar',
props: ['diff'],
2025-03-23 09:29:40 +08:00
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) {
2025-03-23 09:29:40 +08:00
uni.navigateBack()
} else {
if (pages[pages.length - 2] && pages[pages.length - 2].route) {
2025-03-23 09:29:40 +08:00
uni.navigateBack()
} else {
2025-03-23 09:29:40 +08:00
uni.switchTab({ url: '/pages/index/index' })
}
// uni.navigateBack()
2025-03-23 09:29:40 +08:00
}
}
},
},
}
</script>
<style lang="scss" scoped>
.navBar {
position: fixed;
margin: 14rpx 24rpx;
z-index: 500;
2025-03-23 09:29:40 +08:00
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>