| | |
| | | <template> |
| | | <view class="footer flex customer-footer flex-wrap-normal" style=""> |
| | | <view v-for="(item,index) in tabBar" :key="index" class="footer-item"> |
| | | <view class="item" :class="flg==index?'cur':''" @click="go(index,item)"> |
| | | <!-- <view class="item" :class="flg == index ? 'cur' : ''" @click="go(index, item)"> --> |
| | | <view class="item" :class="currentIndex === index ? 'cur' : ''" @click="go(index, item)"> |
| | | |
| | | <!-- <view v-if="index==0"> |
| | | <image src="../../static/images/customer/footer/footer-home-1.png" class="footer-icon" |
| | |
| | | }, |
| | | { |
| | | |
| | | "text": "行程规划", |
| | | "text": "我的种草", |
| | | "pagePath": '/sub-pages/customer/shopping/shopping' |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | "text": "我的", |
| | | "pagePath": '/pages/user/supplier-user' |
| | | "pagePath": '/sub-pages/mine/index' |
| | | } |
| | | ] |
| | | } |
| | |
| | | } |
| | | }, |
| | | created() {}, |
| | | computed: { |
| | | currentPath() { |
| | | const pages = getCurrentPages(); |
| | | const currentPage = pages[pages.length - 1]; |
| | | return '/' + currentPage.route; |
| | | }, |
| | | currentIndex() { |
| | | return this.tabBar.findIndex(item => this.normalizePath(item.pagePath) === this.normalizePath(this.currentPath)); |
| | | } |
| | | }, |
| | | methods: { |
| | | |
| | | normalizePath(path) { |
| | | return path.replace(/^\/+/, '/'); |
| | | }, |
| | | go(index, item) { |
| | | debugger; |
| | | |
| | | uni.navigateTo({ |
| | | url: item.pagePath |
| | | }) |
| | | |
| | | // if (index === 1 || index === 2) { |
| | | // //交易大厅和购物车,这2个可以用跳转方式 |
| | | |
| | | |
| | | // uni.navigateTo({ |
| | | // url: item.pagePath |
| | | // }) |
| | | |
| | | // } else { |
| | | // uni.reLaunch({ |
| | | // url: item.pagePath |
| | | // }); |
| | | // } |
| | | uni.reLaunch({ |
| | | url: item.pagePath |
| | | }) |
| | | |
| | | }, |
| | | } |