|
@@ -46,13 +46,30 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<uni-load-more v-show="visualLoadMore" :status="loadMoreStatus"></uni-load-more>
|
|
|
+ <!-- 与包裹页面所有内容的元素u-page同级,且在它的下方 -->
|
|
|
+ <u-tabbar v-model="tabbarCurrentIndex" :list="tabbarList" icon-size="50" :active-color="tabbarActiveColor" :inactive-color="tabbarInactiveColor"></u-tabbar>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
- import { ref } from 'vue'
|
|
|
+ import { ref, computed } from 'vue'
|
|
|
import { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
|
|
|
import { query, count } from '@/api/chat.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 = 1
|
|
|
|
|
|
const uToast = ref()
|
|
|
|
|
@@ -190,6 +207,7 @@
|
|
|
onSearch()
|
|
|
count().then(res => {
|
|
|
if (res && res.message === 'success') {
|
|
|
+ tabbarStore.setMessageCount(res.data.amount)
|
|
|
uni.setTabBarBadge({ //显示数字
|
|
|
index: 1, //tabbar下标
|
|
|
text: `${res.data.amount}` ?? '0' //数字
|