| | |
| | | <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 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="currentIndex === index ? 'cur' : ''" @click="go(index, item)"> |
| | | |
| | | <!-- <view v-if="index==0"> |
| | | <!-- <view v-if="index==0"> |
| | | <image src="../../static/images/customer/footer/footer-home-1.png" class="footer-icon" |
| | | v-if="flg==0"></image> |
| | | <image src="../../static/images/customer/footer/footer-home-0.png" class="footer-icon" |
| | |
| | | v-if="flg!=3"></image> |
| | | </view> --> |
| | | |
| | | <view> |
| | | {{item.text}} |
| | | </view> |
| | | |
| | | <view> |
| | | {{ item.text }} |
| | | </view> |
| | | |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | </view> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | tabBar: [{ |
| | | export default { |
| | | data() { |
| | | return { |
| | | tabBar: [{ |
| | | |
| | | "text": "首页", |
| | | "pagePath": '/pages/home/home' |
| | | }, |
| | | { |
| | | |
| | | "text": "影视地图", |
| | | "pagePath": '/sub-pages/film-map/index' |
| | | }, |
| | | { |
| | | |
| | | "text": "行程规划", |
| | | "pagePath": '/sub-pages/customer/shopping/shopping' |
| | | }, |
| | | { |
| | | "text": "社区", |
| | | "pagePath": '/pages/user/supplier-user' |
| | | }, |
| | | { |
| | | "text": "我的", |
| | | "pagePath": '/pages/user/supplier-user' |
| | | } |
| | | ] |
| | | } |
| | | }, |
| | | props: { |
| | | flg: { |
| | | type: String, |
| | | "text": "首页", |
| | | "pagePath": '/pages/home/home' |
| | | }, |
| | | bussincess: { |
| | | type: Boolean, |
| | | default () { |
| | | return false |
| | | } |
| | | } |
| | | }, |
| | | created() {}, |
| | | methods: { |
| | | { |
| | | |
| | | 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 |
| | | // }); |
| | | // } |
| | | |
| | | "text": "影视地图", |
| | | "pagePath": '/sub-pages/film-map/index' |
| | | }, |
| | | { |
| | | |
| | | "text": "我的种草", |
| | | "pagePath": '/sub-pages/customer/shopping/shopping' |
| | | }, |
| | | { |
| | | "text": "社区", |
| | | "pagePath": '/pages/user/supplier-user' |
| | | }, |
| | | { |
| | | "text": "我的", |
| | | "pagePath": '/sub-pages/mine/index' |
| | | } |
| | | ] |
| | | } |
| | | }, |
| | | props: { |
| | | flg: { |
| | | type: String, |
| | | }, |
| | | bussincess: { |
| | | type: Boolean, |
| | | default() { |
| | | return false |
| | | } |
| | | } |
| | | }, |
| | | 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) { |
| | | |
| | | // uni.navigateTo({ |
| | | // url: item.pagePath |
| | | // }) |
| | | uni.reLaunch({ |
| | | url: item.pagePath |
| | | }) |
| | | |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="scss"> |
| | | @import "./main.scss"; |
| | | @import "./main.scss"; |
| | | </style> |