|
|
|
@ -1,10 +1,13 @@ |
|
|
|
<script setup> |
|
|
|
import { ref } from "vue"; |
|
|
|
import { computed, ref } from "vue"; |
|
|
|
import useStore from "@/store"; |
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
|
tabIndex: String | Number, |
|
|
|
}); |
|
|
|
|
|
|
|
const store = useStore(); |
|
|
|
|
|
|
|
/** |
|
|
|
* 底部导航栏下标 |
|
|
|
*/ |
|
|
|
@ -20,7 +23,7 @@ const activeColor = "#06CA64"; |
|
|
|
/** |
|
|
|
* 购物车数量 |
|
|
|
*/ |
|
|
|
const cartCount = ref(0); |
|
|
|
const cartCount = computed(() => store.count); |
|
|
|
|
|
|
|
/** |
|
|
|
* 底部导航栏标签信息 |
|
|
|
@ -93,6 +96,7 @@ function onChangeTab(index) { |
|
|
|
<view class="name" :style="{ color: activeTab === index ? activeColor : inactiveColor }"> |
|
|
|
{{ tab.text }} |
|
|
|
</view> |
|
|
|
|
|
|
|
<view v-if="index === 3 && cartCount !== 0" class="badge"> |
|
|
|
{{ cartCount }} |
|
|
|
</view> |
|
|
|
|