add TabSplitView
This commit is contained in:
+33
-96
@@ -10,45 +10,39 @@
|
||||
<navbar-notify-button />
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main class="tui-page-content" :class="mergedLayout ? 'wide-split' : 'scroll column'">
|
||||
<!-- 平板横屏:门店与客户合并成一页,两栏各自保留导航栏 -->
|
||||
<div v-if="mergedLayout" class="split">
|
||||
<section class="pane store-pane">
|
||||
<t-navbar :z-index="20" title="门店">
|
||||
<template #right>
|
||||
<t-button
|
||||
aria-label="刷新"
|
||||
@click="storeOverviewRef?.refresh()"
|
||||
theme="default"
|
||||
variant="text"
|
||||
size="small"
|
||||
>
|
||||
<t-icon name="refresh" size="1.25rem" />
|
||||
</t-button>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<div class="pane-body">
|
||||
<store-overview ref="storeOverviewRef" compact />
|
||||
</div>
|
||||
</section>
|
||||
<section class="pane entry-pane">
|
||||
<t-navbar :z-index="20" title="客户">
|
||||
<template #right>
|
||||
<navbar-notify-button />
|
||||
</template>
|
||||
</t-navbar>
|
||||
<div class="pane-body">
|
||||
<pending-notice-bar />
|
||||
<customer-entry-panel />
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<template v-else>
|
||||
<div class="tab-body">
|
||||
<pending-notice-bar />
|
||||
<customer-entry-panel />
|
||||
</div>
|
||||
<!-- 平板横屏:门店与客户合并成一页,两栏各自保留导航栏 -->
|
||||
<tab-split-view
|
||||
v-if="mergedLayout"
|
||||
left-title="门店"
|
||||
right-title="客户"
|
||||
>
|
||||
<template #left-actions>
|
||||
<t-button
|
||||
aria-label="刷新"
|
||||
@click="storeOverviewRef?.refresh()"
|
||||
theme="default"
|
||||
variant="text"
|
||||
size="small"
|
||||
>
|
||||
<t-icon name="refresh" size="1.25rem" />
|
||||
</t-button>
|
||||
</template>
|
||||
<template #left>
|
||||
<store-overview ref="storeOverviewRef" compact />
|
||||
</template>
|
||||
<template #right-actions>
|
||||
<navbar-notify-button />
|
||||
</template>
|
||||
<template #right>
|
||||
<pending-notice-bar />
|
||||
<customer-entry-panel />
|
||||
</template>
|
||||
</tab-split-view>
|
||||
<main v-else class="tui-page-content scroll column">
|
||||
<div class="tab-body">
|
||||
<pending-notice-bar />
|
||||
<customer-entry-panel />
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
@@ -60,6 +54,7 @@ import PendingNoticeBar from "./component/PendingNoticeBar.vue";
|
||||
import CustomerEntryPanel from "./component/CustomerEntryPanel.vue";
|
||||
import NavbarNotifyButton from "./component/NavbarNotifyButton.vue";
|
||||
import StoreOverview from "./component/StoreOverview.vue";
|
||||
import TabSplitView from "./component/TabSplitView.vue";
|
||||
import { permissionCodes } from "@/utils/permission";
|
||||
|
||||
defineOptions({
|
||||
@@ -74,61 +69,3 @@ const { isWide } = useLayout({ tablet: true });
|
||||
const mergedLayout = computed(() => isWide.value && userStore.hasPermissions(permissionCodes.stat.read));
|
||||
const storeOverviewRef = ref<InstanceType<typeof StoreOverview>>();
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.home-tab {
|
||||
|
||||
.wide-split {
|
||||
overflow: hidden;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.split {
|
||||
flex: 1;
|
||||
display: grid;
|
||||
min-height: 0;
|
||||
grid-template-columns: minmax(0, 1fr) clamp(24rem, 28vw, 28rem);
|
||||
}
|
||||
|
||||
.pane {
|
||||
display: flex;
|
||||
position: relative;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
flex-direction: column;
|
||||
|
||||
&:first-child {
|
||||
border-right: 1px solid var(--td-component-border);
|
||||
}
|
||||
|
||||
// 栏内导航栏贴在栏顶,内容从它下方滚过,和整页的毛玻璃效果一致
|
||||
.t-navbar {
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
position: absolute;
|
||||
|
||||
// navbar 默认 fixed:内容层原本贴着视口,这里收回栏内;
|
||||
// 占位块是给 fixed 模式撑高度用的,栏内不需要
|
||||
:deep(.t-navbar__content) {
|
||||
left: 0;
|
||||
right: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
:deep(.t-navbar__placeholder) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.pane-body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
padding-top: calc(var(--tui-nav-height, 48px) + 1rem);
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
+88
-185
@@ -1,214 +1,117 @@
|
||||
<template>
|
||||
<t-navbar fixed :z-index="20" title="产品" />
|
||||
<main class="tui-page-content scroll column product-tab">
|
||||
<div class="tab-body menu-grid">
|
||||
<t-cell-group
|
||||
v-for="(group, index) in visibleMenuGroupList"
|
||||
:key="group.title"
|
||||
class="menu-group"
|
||||
:title="group.title"
|
||||
theme="card"
|
||||
v-entrance-transition
|
||||
>
|
||||
<t-cell
|
||||
v-for="item in group.items"
|
||||
:key="item.path"
|
||||
class="menu-item"
|
||||
:title="item.title"
|
||||
arrow
|
||||
hover
|
||||
@click="go(item.path)"
|
||||
<div class="tui-page-layout tui-navbar product-tab">
|
||||
<t-navbar
|
||||
v-if="!mergedLayout"
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="产品"
|
||||
/>
|
||||
<!-- 平板横屏:经营图表与产品入口合并成一页,两栏各自保留导航栏 -->
|
||||
<tab-split-view
|
||||
v-if="mergedLayout"
|
||||
left-title="经营图表"
|
||||
right-title="产品"
|
||||
>
|
||||
<template #left-actions>
|
||||
<t-button
|
||||
aria-label="刷新"
|
||||
@click="panelRef?.reload()"
|
||||
theme="default"
|
||||
variant="text"
|
||||
size="small"
|
||||
>
|
||||
<template #leftIcon>
|
||||
<span class="icon-wrap" :class="`tone-${index}`"><t-icon :name="item.icon" size="1.35rem" /></span>
|
||||
</template>
|
||||
</t-cell>
|
||||
</t-cell-group>
|
||||
</div>
|
||||
<center-tips v-if="!visibleMenuGroupList.length" :content="'当前账号暂无产品管理权限'" />
|
||||
</main>
|
||||
<t-icon name="refresh" size="1.25rem" />
|
||||
</t-button>
|
||||
</template>
|
||||
<template #left>
|
||||
<div class="left">
|
||||
<div class="chart-switch glass-header">
|
||||
<t-segmented
|
||||
v-model="chartMode"
|
||||
class="switch"
|
||||
block
|
||||
:options="chartModeOptions"
|
||||
/>
|
||||
</div>
|
||||
<product-charts-panel
|
||||
v-if="chartMode === 'product'"
|
||||
ref="panelRef"
|
||||
embedded
|
||||
compact
|
||||
/>
|
||||
<order-charts-panel
|
||||
v-else
|
||||
ref="panelRef"
|
||||
embedded
|
||||
compact
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<template #right>
|
||||
<product-entry-panel compact hide-analysis />
|
||||
</template>
|
||||
</tab-split-view>
|
||||
<main v-else class="tui-page-content scroll column product-tab-body">
|
||||
<div class="tab-body">
|
||||
<product-entry-panel />
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useUserStore } from "timi-web-api";
|
||||
import { useLayout } from "timi-tdesign-mobile";
|
||||
import ProductEntryPanel from "./component/ProductEntryPanel.vue";
|
||||
import TabSplitView from "./component/TabSplitView.vue";
|
||||
import { permissionCodes } from "@/utils/permission";
|
||||
|
||||
type MenuItem = {
|
||||
icon: string;
|
||||
path: string;
|
||||
title: string;
|
||||
visible: boolean;
|
||||
};
|
||||
type ChartMode = "product" | "order";
|
||||
|
||||
type MenuGroup = {
|
||||
items: MenuItem[];
|
||||
title: string;
|
||||
};
|
||||
// 图表带 echarts 全家桶,只有横屏分栏才会用到,异步加载避免拖累手机端的首屏
|
||||
const ProductChartsPanel = defineAsyncComponent(() => import("@/pages/product/component/ProductChartsPanel.vue"));
|
||||
const OrderChartsPanel = defineAsyncComponent(() => import("@/pages/product/component/OrderChartsPanel.vue"));
|
||||
|
||||
defineOptions({
|
||||
name: "ProductTab"
|
||||
});
|
||||
|
||||
const router = useRouter();
|
||||
const userStore = useUserStore();
|
||||
|
||||
const menuGroupList = computed<MenuGroup[]>(() => [
|
||||
{
|
||||
title: "产品管理",
|
||||
items: [
|
||||
{
|
||||
icon: "catalog",
|
||||
path: "/management/product-categories",
|
||||
title: "产品分类",
|
||||
visible: userStore.hasPermissions(permissionCodes.productCategory.read)
|
||||
},
|
||||
{
|
||||
icon: "control-platform",
|
||||
path: "/management/products",
|
||||
title: "产品库",
|
||||
visible: userStore.hasPermissions(permissionCodes.product.read)
|
||||
},
|
||||
{
|
||||
icon: "wallet",
|
||||
path: "/management/product-stocks",
|
||||
title: "库存",
|
||||
visible: userStore.hasPermissions(permissionCodes.productStock.read)
|
||||
},
|
||||
{
|
||||
icon: "history",
|
||||
path: "/management/product-stock-records",
|
||||
title: "库存流水",
|
||||
visible: userStore.hasPermissions(permissionCodes.productStock.read)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "交易管理",
|
||||
items: [
|
||||
{
|
||||
icon: "task",
|
||||
path: "/management/sales-orders",
|
||||
title: "销售订单",
|
||||
visible: userStore.hasPermissions(permissionCodes.salesOrder.read)
|
||||
},
|
||||
{
|
||||
icon: "wallet",
|
||||
path: "/management/fund-records",
|
||||
title: "资金流水",
|
||||
visible: userStore.hasPermissions(permissionCodes.fundRecord.read)
|
||||
},
|
||||
{
|
||||
icon: "undertake-delivery",
|
||||
path: "/management/order-fulfillments",
|
||||
title: "履约记录",
|
||||
visible: userStore.hasPermissions(permissionCodes.orderFulfillment.read)
|
||||
},
|
||||
{
|
||||
icon: "money",
|
||||
path: "/management/consumption-records",
|
||||
title: "消费记录",
|
||||
visible: userStore.hasPermissions(permissionCodes.salesOrder.read)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "套餐管理",
|
||||
items: [
|
||||
{
|
||||
icon: "layers",
|
||||
path: "/management/package-configs",
|
||||
title: "套餐配置",
|
||||
visible: userStore.hasPermissions(permissionCodes.packageConfig.read)
|
||||
},
|
||||
{
|
||||
icon: "task",
|
||||
path: "/management/package-orders",
|
||||
title: "套餐订单",
|
||||
visible: userStore.hasPermissions(permissionCodes.packageConfig.read)
|
||||
&& userStore.hasPermissions(permissionCodes.salesOrder.read)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "积分兑换",
|
||||
items: [
|
||||
{
|
||||
icon: "cart",
|
||||
path: "/management/points/redeem-skus",
|
||||
title: "兑换商品",
|
||||
visible: userStore.hasPermissions(permissionCodes.pointRedeemSku.manage)
|
||||
},
|
||||
{
|
||||
icon: "gift",
|
||||
path: "/management/points/redemptions",
|
||||
title: "积分兑换",
|
||||
visible: userStore.hasPermissions(permissionCodes.pointRedemption.create)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "经营分析",
|
||||
items: [
|
||||
{
|
||||
icon: "chart-analytics",
|
||||
path: "/management/product-data-charts",
|
||||
title: "产品经营图表",
|
||||
visible: userStore.hasPermissions(permissionCodes.stat.read)
|
||||
},
|
||||
{
|
||||
icon: "chart-combo",
|
||||
path: "/management/order-data-charts",
|
||||
title: "客户经营图表",
|
||||
visible: userStore.hasPermissions(permissionCodes.stat.read)
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
||||
// 横屏平板(出现左侧导航栏)才合并经营图表与产品入口;
|
||||
// 没有统计权限的账号本来就没有图表入口,这里同样不显示左侧分栏
|
||||
const { isWide } = useLayout({ tablet: true });
|
||||
const mergedLayout = computed(() => isWide.value && userStore.hasPermissions(permissionCodes.stat.read));
|
||||
const panelRef = ref<{ reload: () => Promise<void> }>();
|
||||
|
||||
const visibleMenuGroupList = computed<MenuGroup[]>(() => menuGroupList.value
|
||||
.map(group => ({
|
||||
...group,
|
||||
items: group.items.filter(item => item.visible)
|
||||
}))
|
||||
.filter(group => group.items.length));
|
||||
// ---------- 图表切换 ----------
|
||||
|
||||
async function go(path: string): Promise<void> {
|
||||
await router.push(path);
|
||||
}
|
||||
const chartMode = ref<ChartMode>("product");
|
||||
const chartModeOptions = [
|
||||
{ value: "product" as ChartMode, label: "产品经营" },
|
||||
{ value: "order" as ChartMode, label: "客户经营" }
|
||||
];
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.product-tab {
|
||||
gap: .5rem;
|
||||
|
||||
.tab-body {
|
||||
--tab-body-max: 72rem;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 平板起分组卡片并排:同一屏能看到更多分组,
|
||||
* 行宽也不会被拉到整屏宽(手机形态完全不变)。
|
||||
*/
|
||||
.menu-grid {
|
||||
gap: .5rem;
|
||||
display: grid;
|
||||
padding: 0 1rem;
|
||||
align-items: start;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
|
||||
// 卡片自带 16px 外边距,进栅格后间距交给容器的 padding 和 gap
|
||||
:deep(.t-cell-group--card) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media (min-width: 48rem) {
|
||||
gap: .75rem;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
@media (min-width: 80rem) {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 图表切换吸在栏内导航下方,滚动图表时不用回顶部。
|
||||
*
|
||||
* sticky 的偏移是相对滚动容器的内容盒算的,而 .pane-body 顶部有
|
||||
* calc(导航高 + .5rem) 的内边距,所以这里要减去那 .5rem 才能贴住导航底边。
|
||||
*/
|
||||
.chart-switch {
|
||||
top: -1rem;
|
||||
z-index: 5;
|
||||
padding: 1rem;
|
||||
margin-top: -1rem;
|
||||
position: sticky;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<t-navbar fixed :z-index="20" title="管理" />
|
||||
<main class="tui-page-content scroll column management-tab">
|
||||
<div class="tab-body">
|
||||
<div class="menu-grid">
|
||||
<div class="menus">
|
||||
<t-cell-group class="user-card" theme="card" v-entrance-transition>
|
||||
<t-cell
|
||||
v-if="currentUser"
|
||||
@@ -347,7 +347,7 @@ onBeforeRouteLeave(() => {
|
||||
* 和分组卡片并排会在下面留下一大块空白。
|
||||
* 手机上仍是单列,间距保持 .5rem。
|
||||
*/
|
||||
.menu-grid {
|
||||
.menus {
|
||||
gap: .5rem;
|
||||
display: grid;
|
||||
padding: 0 1rem;
|
||||
|
||||
@@ -162,11 +162,7 @@ async function openAiChat(): Promise<void> {
|
||||
.entry-panel {
|
||||
|
||||
.entry-group {
|
||||
margin: 0 1rem;
|
||||
|
||||
& + & {
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
margin: 1rem;
|
||||
|
||||
> h2 {
|
||||
color: #52607a;
|
||||
@@ -255,4 +251,4 @@ async function openAiChat(): Promise<void> {
|
||||
--entry-background: rgba(15, 23, 42, .88);
|
||||
box-shadow: 0 .75rem 2rem rgba(2, 6, 23, .32);
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
<template>
|
||||
<div class="menus" :class="{ compact }">
|
||||
<t-cell-group
|
||||
v-for="(group, index) in visibleMenuGroupList"
|
||||
:key="index"
|
||||
class="menu-group"
|
||||
theme="card"
|
||||
v-entrance-transition
|
||||
>
|
||||
<t-cell
|
||||
v-for="item in group.items"
|
||||
:key="item.path"
|
||||
class="menu-item"
|
||||
:title="item.title"
|
||||
arrow
|
||||
hover
|
||||
@click="go(item.path)"
|
||||
>
|
||||
<template #leftIcon>
|
||||
<t-icon :name="item.icon" size="1.35rem" />
|
||||
</template>
|
||||
</t-cell>
|
||||
</t-cell-group>
|
||||
</div>
|
||||
<center-tips v-if="!visibleMenuGroupList.length" :content="'当前账号暂无产品管理权限'" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useUserStore } from "timi-web-api";
|
||||
import { permissionCodes } from "@/utils/permission";
|
||||
|
||||
type MenuItem = {
|
||||
icon: string;
|
||||
path: string;
|
||||
title: string;
|
||||
visible: boolean;
|
||||
};
|
||||
|
||||
type MenuGroup = {
|
||||
items: MenuItem[];
|
||||
/** 分组的稳定标识,用于按场景隐藏整组 */
|
||||
key?: "analysis";
|
||||
};
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
/** 分栏窄栏里固定单列 */
|
||||
compact?: boolean;
|
||||
/** 横屏分栏左侧已经展示图表,右侧不再重复「经营分析」入口 */
|
||||
hideAnalysis?: boolean;
|
||||
}>(), {
|
||||
compact: false,
|
||||
hideAnalysis: false
|
||||
});
|
||||
|
||||
defineOptions({
|
||||
name: "ProductEntryPanel"
|
||||
});
|
||||
|
||||
const router = useRouter();
|
||||
const userStore = useUserStore();
|
||||
|
||||
const menuGroupList = computed<MenuGroup[]>(() => [
|
||||
{
|
||||
items: [
|
||||
{
|
||||
icon: "catalog",
|
||||
path: "/management/product-categories",
|
||||
title: "产品分类",
|
||||
visible: userStore.hasPermissions(permissionCodes.productCategory.read)
|
||||
},
|
||||
{
|
||||
icon: "control-platform",
|
||||
path: "/management/products",
|
||||
title: "产品库",
|
||||
visible: userStore.hasPermissions(permissionCodes.product.read)
|
||||
},
|
||||
{
|
||||
icon: "wallet",
|
||||
path: "/management/product-stocks",
|
||||
title: "库存",
|
||||
visible: userStore.hasPermissions(permissionCodes.productStock.read)
|
||||
},
|
||||
{
|
||||
icon: "history",
|
||||
path: "/management/product-stock-records",
|
||||
title: "库存流水",
|
||||
visible: userStore.hasPermissions(permissionCodes.productStock.read)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{
|
||||
icon: "task",
|
||||
path: "/management/sales-orders",
|
||||
title: "销售订单",
|
||||
visible: userStore.hasPermissions(permissionCodes.salesOrder.read)
|
||||
},
|
||||
{
|
||||
icon: "wallet",
|
||||
path: "/management/fund-records",
|
||||
title: "资金流水",
|
||||
visible: userStore.hasPermissions(permissionCodes.fundRecord.read)
|
||||
},
|
||||
{
|
||||
icon: "undertake-delivery",
|
||||
path: "/management/order-fulfillments",
|
||||
title: "履约记录",
|
||||
visible: userStore.hasPermissions(permissionCodes.orderFulfillment.read)
|
||||
},
|
||||
{
|
||||
icon: "money",
|
||||
path: "/management/consumption-records",
|
||||
title: "消费记录",
|
||||
visible: userStore.hasPermissions(permissionCodes.salesOrder.read)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{
|
||||
icon: "layers",
|
||||
path: "/management/package-configs",
|
||||
title: "套餐配置",
|
||||
visible: userStore.hasPermissions(permissionCodes.packageConfig.read)
|
||||
},
|
||||
{
|
||||
icon: "task",
|
||||
path: "/management/package-orders",
|
||||
title: "套餐订单",
|
||||
visible: userStore.hasPermissions(permissionCodes.packageConfig.read)
|
||||
&& userStore.hasPermissions(permissionCodes.salesOrder.read)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{
|
||||
icon: "cart",
|
||||
path: "/management/points/redeem-skus",
|
||||
title: "兑换商品",
|
||||
visible: userStore.hasPermissions(permissionCodes.pointRedeemSku.manage)
|
||||
},
|
||||
{
|
||||
icon: "gift",
|
||||
path: "/management/points/redemptions",
|
||||
title: "积分兑换",
|
||||
visible: userStore.hasPermissions(permissionCodes.pointRedemption.create)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: "analysis",
|
||||
items: [
|
||||
{
|
||||
icon: "chart-analytics",
|
||||
path: "/management/product-data-charts",
|
||||
title: "产品经营图表",
|
||||
visible: userStore.hasPermissions(permissionCodes.stat.read)
|
||||
},
|
||||
{
|
||||
icon: "chart-combo",
|
||||
path: "/management/order-data-charts",
|
||||
title: "客户经营图表",
|
||||
visible: userStore.hasPermissions(permissionCodes.stat.read)
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
||||
|
||||
const visibleMenuGroupList = computed<MenuGroup[]>(() => menuGroupList.value
|
||||
.filter(group => !props.hideAnalysis || group.key !== "analysis")
|
||||
.map(group => ({
|
||||
...group,
|
||||
items: group.items.filter(item => item.visible)
|
||||
}))
|
||||
.filter(group => group.items.length));
|
||||
|
||||
async function go(path: string): Promise<void> {
|
||||
await router.push(path);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.menus {
|
||||
gap: 2rem;
|
||||
display: flex;
|
||||
margin-top: 1rem;
|
||||
flex-direction: column;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,110 @@
|
||||
<template>
|
||||
<main class="tui-page-content wide-split">
|
||||
<div class="split">
|
||||
<section class="pane">
|
||||
<t-navbar :z-index="20" :title="leftTitle">
|
||||
<template #right>
|
||||
<slot name="left-actions"/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<div class="pane-body">
|
||||
<slot name="left"/>
|
||||
</div>
|
||||
</section>
|
||||
<section class="pane">
|
||||
<t-navbar :z-index="20" :title="rightTitle">
|
||||
<template #right>
|
||||
<slot name="right-actions"/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<div class="pane-body">
|
||||
<slot name="right"/>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "TabSplitView"
|
||||
});
|
||||
|
||||
defineProps<{
|
||||
/** 左栏导航栏标题 */
|
||||
leftTitle: string;
|
||||
/** 右栏导航栏标题 */
|
||||
rightTitle: string;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
/**
|
||||
* 平板横屏的两栏骨架:每栏一条自己的导航栏,内容从导航下方滚过。
|
||||
*
|
||||
* 页面只需提供两栏内容,栏宽、栏内导航定位、滚动容器都在这里统一。
|
||||
*/
|
||||
/**
|
||||
* 必须写成 `.tui-page-content.wide-split` 复合选择器:
|
||||
* 库里 `.tui-page-layout .tui-page-content` 是两个类,我们单写 `.wide-split`(1 类 + 1 作用域属性)
|
||||
* 权重打平且库样式在后,padding-top 会被 48px+1rem 盖回来,两条导航栏整体被顶下去。
|
||||
*/
|
||||
.tui-page-content.wide-split {
|
||||
overflow: hidden;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.split {
|
||||
flex: 1;
|
||||
display: grid;
|
||||
min-height: 0;
|
||||
grid-template-columns: minmax(0, 1fr) clamp(24rem, 28vw, 28rem);
|
||||
}
|
||||
|
||||
.pane {
|
||||
display: flex;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
flex-direction: column;
|
||||
|
||||
&:first-child {
|
||||
border-right: 1px solid var(--td-component-border);
|
||||
}
|
||||
|
||||
// 栏内导航栏贴在栏顶,内容从它下方滚过,和整页的毛玻璃效果一致
|
||||
.t-navbar {
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
/**
|
||||
* navbar 默认 fixed:内容层原本贴着视口,这里收回栏内。
|
||||
*
|
||||
* 选择器必须同时带 .t-navbar 和 .t-navbar--fixed(同一个元素上的两个类),
|
||||
* 权重才压得住库里的
|
||||
* `.tui-app-shell.is-rail .t-navbar--fixed .t-navbar__content { left: var(--tui-fixed-left) }`,
|
||||
* 否则横屏下整条导航会右移一个左侧导航栏的宽度。
|
||||
*/
|
||||
:deep(.t-navbar.t-navbar--fixed .t-navbar__content) {
|
||||
left: 0;
|
||||
right: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
:deep(.t-navbar__placeholder) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.pane-body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
padding-top: calc(var(--tui-nav-height, 48px) + 1rem);
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user