31 lines
874 B
Vue
31 lines
874 B
Vue
|
<script setup>
|
||
|
const tabbar = ref('index')
|
||
|
const menu = reactive([{ title: '首页', icon: 'home', name: 'index' }, { title: 'AI律师', icon: 'chat', name: 'ai' }, { title: '我的', icon: 'user', name: 'me' }])
|
||
|
function tabChange({ value }) {
|
||
|
uni.switchTab({
|
||
|
url: `/pages/${value}`,
|
||
|
})
|
||
|
}
|
||
|
|
||
|
onShow(() => {
|
||
|
const currentPage = getCurrentPages()[getCurrentPages().length - 1].route
|
||
|
const pageName = currentPage.split('/').pop()
|
||
|
tabbar.value = pageName
|
||
|
})
|
||
|
onMounted(() => {
|
||
|
uni.hideTabBar()
|
||
|
})
|
||
|
</script>
|
||
|
|
||
|
<template>
|
||
|
<wd-tabbar v-model="tabbar" custom-class="qnc-tabbar" shape="round" safe-area-inset-bottom fixed @change="tabChange">
|
||
|
<wd-tabbar-item v-for="(item, index) in menu" :key="index" :name="item.name" :title="item.title" :icon="item.icon" />
|
||
|
</wd-tabbar>
|
||
|
</template>
|
||
|
|
||
|
<style scoped>
|
||
|
:deep(.qnc-tabbar) {
|
||
|
bottom: 16px !important;
|
||
|
}
|
||
|
</style>
|