45 lines
1.1 KiB
Vue
45 lines
1.1 KiB
Vue
<template>
|
|
<app-shell
|
|
v-model="active"
|
|
:items="tabList"
|
|
:mode="mode"
|
|
logo-text="糕"
|
|
@change="onTabChange"
|
|
>
|
|
<page-transition transition="push-left" />
|
|
</app-shell>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { inject, ref, watch } from "vue";
|
|
import { useRoute, useRouter } from "vue-router";
|
|
import {
|
|
AppShell,
|
|
PageTransition,
|
|
type AppShellItem,
|
|
type AppShellMode
|
|
} from "timi-tdesign-mobile";
|
|
import { appShellDemoModeKey } from "./context";
|
|
|
|
const mode = inject(appShellDemoModeKey, ref<AppShellMode>("wide"));
|
|
const route = useRoute();
|
|
const router = useRouter();
|
|
|
|
const tabList: AppShellItem[] = [
|
|
{ value: "/customers", icon: "usergroup", text: "客户", badge: 12 },
|
|
{ value: "/product", icon: "layers", text: "产品" },
|
|
{ value: "/store", icon: "shop-3", text: "门店" },
|
|
{ value: "/management", icon: "setting-1", text: "管理" }
|
|
];
|
|
|
|
const active = ref(route.path);
|
|
|
|
watch(() => route.path, path => {
|
|
active.value = path;
|
|
});
|
|
|
|
async function onTabChange(value: string | number): Promise<void> {
|
|
await router.push(String(value));
|
|
}
|
|
</script>
|