|
@@ -107,6 +107,8 @@
|
|
<text>请登录后使用该功能</text>
|
|
<text>请登录后使用该功能</text>
|
|
</view>
|
|
</view>
|
|
</u-modal>
|
|
</u-modal>
|
|
|
|
+ <!-- 与包裹页面所有内容的元素u-page同级,且在它的下方 -->
|
|
|
|
+ <u-tabbar v-model="tabbarCurrentIndex" :list="tabbarList" icon-size="50" :active-color="tabbarActiveColor" :inactive-color="tabbarInactiveColor"></u-tabbar>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -114,7 +116,8 @@
|
|
import lgSwiper from '@/components/lgSwiper.vue'
|
|
import lgSwiper from '@/components/lgSwiper.vue'
|
|
import {
|
|
import {
|
|
onMounted,
|
|
onMounted,
|
|
- ref
|
|
|
|
|
|
+ ref,
|
|
|
|
+ computed
|
|
} from 'vue'
|
|
} from 'vue'
|
|
import {
|
|
import {
|
|
onReady,
|
|
onReady,
|
|
@@ -136,6 +139,23 @@
|
|
import {
|
|
import {
|
|
me
|
|
me
|
|
} from '@/api/user.js'
|
|
} from '@/api/user.js'
|
|
|
|
+
|
|
|
|
+ import { useTabbarStore } from '@/store/tabbarStore.js'
|
|
|
|
+ const tabbarStore = useTabbarStore()
|
|
|
|
+ // 底部导航栏数据
|
|
|
|
+ const tabbarList = computed(() => {
|
|
|
|
+ return tabbarStore.list
|
|
|
|
+ })
|
|
|
|
+ // 底部导航栏选中颜色
|
|
|
|
+ const tabbarActiveColor = computed(() => {
|
|
|
|
+ return tabbarStore.activeColor
|
|
|
|
+ })
|
|
|
|
+ // 底部导航栏未选中颜色
|
|
|
|
+ const tabbarInactiveColor = computed(() => {
|
|
|
|
+ return tabbarStore.inactiveColor
|
|
|
|
+ })
|
|
|
|
+ const tabbarCurrentIndex = 0
|
|
|
|
+
|
|
const authStore = useAuthStore()
|
|
const authStore = useAuthStore()
|
|
// 屏幕状态栏高度
|
|
// 屏幕状态栏高度
|
|
const statusBarHeight = ref(0)
|
|
const statusBarHeight = ref(0)
|
|
@@ -338,6 +358,7 @@
|
|
function getCharCount() {
|
|
function getCharCount() {
|
|
count().then(res => {
|
|
count().then(res => {
|
|
if (res && res.message === 'success') {
|
|
if (res && res.message === 'success') {
|
|
|
|
+ tabbarStore.setMessageCount(res.data.amount)
|
|
uni.setTabBarBadge({ //显示数字
|
|
uni.setTabBarBadge({ //显示数字
|
|
index: 1, //tabbar下标
|
|
index: 1, //tabbar下标
|
|
text: `${res.data.amount}` ?? '0' //数字
|
|
text: `${res.data.amount}` ?? '0' //数字
|
|
@@ -385,7 +406,7 @@
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|
|
|
|
|
|
-<style lang="scss" scoped>
|
|
|
|
|
|
+<style lang="scss" scoped>
|
|
.container {
|
|
.container {
|
|
width: 100vw;
|
|
width: 100vw;
|
|
background-color: $uni-bg-color;
|
|
background-color: $uni-bg-color;
|