This commit is contained in:
hero920103 committed 2026-11-11 18:42:09 +08:00
1 parent fb04d66e61
commit b6b528490c
13 files changed
+518 -168

No files matched your search

+18 -5
View File
@@ -2,7 +2,7 @@
<view class="app-tabbar">
<view class="tabbar-inner">
<view
v-for="tab in tabs"
v-for="tab in list"
:key="tab.name"
class="tab-item"
:class="{ active: current === tab.name }"
@@ -21,23 +21,32 @@
</template>
<script setup>
import { computed } from 'vue'
/**
* 主 tabbar —— 工作台 / 应用 / 我的。
* 仅这三个页面使用;子系统内部页面请用 AppTabbar(带 group 参数)。
* 主 tabbar —— 默认「工作台 / 应用 / 我的」。
* 传入 tabs 时按自定义页签渲染(个人中心用「我的 / 回平台」两项);
* name=platform 为特殊动作:清空页面栈回到平台模块选择页。
*/
const props = defineProps({
current: {
type: String,
default: 'dashboard'
},
tabs: {
type: Array,
default: null
}
})
const tabs = [
const DEFAULT_TABS = [
{ name: 'dashboard', text: '工作台', icon: 'grip' },
{ name: 'features', text: '应用', icon: 'th-large' },
{ name: 'profile', text: '我的', icon: 'user' }
]
const list = computed(() => (props.tabs && props.tabs.length ? props.tabs : DEFAULT_TABS))
const routes = {
dashboard: '/pages/dashboard/dashboard',
features: '/pages/features/features',
@@ -45,7 +54,11 @@ const routes = {
}
function onChange(name) {
if (name === props.current) return
if (name === 'platform') {
uni.reLaunch({ url: '/pages/nav/nav' })
return
}
if (name === props.current || !routes[name]) return
uni.redirectTo({ url: routes[name] })
}
</script>