|
|
@@ -1,7 +1,7 @@
|
|
|
<!--
|
|
|
店铺底部导航栏(通用组件)
|
|
|
- 用途:店铺首页/分类/购物车/订单四个入口,供店铺相关页面复用
|
|
|
- 说明:首页跳转暂未实现;购物车跳转 pages/home/cart
|
|
|
+ 用途:店铺首页/分类/购物车三个入口,供店铺相关页面复用
|
|
|
+ 说明:互切用 redirectTo 原页替换,避免栈上新开一层
|
|
|
-->
|
|
|
<template>
|
|
|
<view class="shop-tab-bar">
|
|
|
@@ -35,7 +35,7 @@
|
|
|
export default {
|
|
|
name: 'ShopTabBar',
|
|
|
props: {
|
|
|
- /** 当前选中项:home | category | cart | order */
|
|
|
+ /** 当前选中项:home | category | cart */
|
|
|
current: {
|
|
|
type: String,
|
|
|
default: 'category'
|
|
|
@@ -56,14 +56,13 @@ export default {
|
|
|
tabList: [
|
|
|
{ key: 'home', label: '首页', icon: 'icon-home', activeIcon: 'icon-home-active' },
|
|
|
{ key: 'category', label: '分类', icon: 'icon-category', activeIcon: 'icon-category-active' },
|
|
|
- { key: 'cart', label: '购物车', icon: 'icon-cart', activeIcon: 'icon-cart-active' },
|
|
|
- { key: 'order', label: '订单', icon: 'icon-order', activeIcon: 'icon-order-active' }
|
|
|
+ { key: 'cart', label: '购物车', icon: 'icon-cart', activeIcon: 'icon-cart-active' }
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
/**
|
|
|
- * 底部 Tab 点击:首页/购物车保留占位,分类刷新当前页,订单跳转订单页
|
|
|
+ * 底部 Tab 点击:店铺内页互切用 redirectTo,避免 navigateTo 叠一层「新页面」
|
|
|
*/
|
|
|
onTabTap(item) {
|
|
|
if (item.key === this.current) {
|
|
|
@@ -81,6 +80,7 @@ export default {
|
|
|
if (item.key === 'home') {
|
|
|
this.$util.pageTo({
|
|
|
url: '/pages/home/index',
|
|
|
+ type: 2,
|
|
|
query: shopQuery
|
|
|
})
|
|
|
return
|
|
|
@@ -88,6 +88,7 @@ export default {
|
|
|
if (item.key === 'category') {
|
|
|
this.$util.pageTo({
|
|
|
url: '/pages/home/shop-category',
|
|
|
+ type: 2,
|
|
|
query: shopQuery
|
|
|
})
|
|
|
return
|
|
|
@@ -95,16 +96,9 @@ export default {
|
|
|
if (item.key === 'cart') {
|
|
|
this.$util.pageTo({
|
|
|
url: '/pages/home/cart',
|
|
|
+ type: 2,
|
|
|
query: shopQuery
|
|
|
})
|
|
|
- return
|
|
|
- }
|
|
|
- if (item.key === 'order') {
|
|
|
- this.$util.pageTo({
|
|
|
- url: '/pages/home/order',
|
|
|
- type: 4,
|
|
|
- query: Object.assign({}, shopQuery, { shopNav: 1 })
|
|
|
- })
|
|
|
}
|
|
|
}
|
|
|
}
|