add app-shell, master-detail, pane-transition

This commit is contained in:
Timi
2026-11-02 21:46:30 +08:00
parent 107a3086ba
commit 8f6b8c1eff
32 changed files with 2631 additions and 55 deletions
+16
View File
@@ -0,0 +1,16 @@
import view from "./index.vue";
import { WebToolkit } from "timi-web";
export const AppShell = WebToolkit.withInstall(view);
export default AppShell;
export type {
AppShellItem,
AppShellLayoutOptions,
AppShellMode,
AppShellProps,
AppShellValue
} from "./type";
export { createLayoutContext, provideLayout, useLayout } from "../../composables/use-layout";
export type { LayoutContext } from "../../composables/use-layout";
+309
View File
@@ -0,0 +1,309 @@
<template>
<div class="tui-app-shell" :class="{ 'is-rail': showRail }" :style="shellStyle">
<nav v-if="showRail" class="rail" aria-label="主导航">
<div v-if="logoText || $slots.logo" class="logo">
<slot name="logo">
<span v-text="logoText" />
</slot>
</div>
<t-button
v-for="item in itemList"
:key="item.value"
class="rail-item"
:class="{ on: item.value === modelValue }"
variant="text"
:disabled="item.disabled"
:aria-current="item.value === modelValue ? 'page' : undefined"
@click="onSelect(item)"
>
<t-badge v-if="item.badge && item.icon" :count="item.badge" :offset="[2, -2]">
<t-icon :name="item.icon" size="1.375rem" />
</t-badge>
<t-icon v-else-if="item.icon" :name="item.icon" size="1.375rem" />
<span v-text="item.text" />
</t-button>
<div class="rail-extra">
<slot name="rail-extra" />
</div>
</nav>
<div class="body">
<div class="content">
<slot />
</div>
<t-tab-bar
v-if="showTabBar"
class="tabbar"
:value="modelValue"
:fixed="false"
:z-index="1"
:bordered="false"
:split="false"
:safe-area-inset-bottom="false"
:class="{ 'is-float': tabBarFloat, 'is-hidden': tabBarFloat && hideNav }"
:shape="tabBarFloat ? 'round' : 'normal'"
:theme="tabBarFloat ? 'tag' : 'normal'"
@change="onTabChange"
>
<t-tab-bar-item
v-for="item in itemList"
:key="item.value"
:class="{ 'is-disabled': item.disabled }"
:value="item.value"
:badge-props="item.badge ? { count: item.badge } : undefined"
>
<span v-text="item.text" />
<template #icon>
<t-icon :name="item.icon" />
</template>
</t-tab-bar-item>
</t-tab-bar>
</div>
</div>
</template>
<script setup lang="ts">
import { computed, type StyleValue } from "vue";
import { createLayoutContext, provideLayout } from "../../composables/use-layout";
import type { AppShellItem, AppShellProps, AppShellValue } from "./type";
defineOptions({
name: "AppShell"
});
const props = withDefaults(defineProps<AppShellProps>(), {
tablet: true,
tabletMin: 768,
wideMin: 1024,
railOnPortrait: false,
items: () => [],
modelValue: "",
logoText: "",
hideNav: false,
hideRail: false,
tabBarFloat: false,
railWidth: 96,
tabBarHeight: 52
});
const emit = defineEmits<{
"update:modelValue": [value: AppShellValue];
"change": [value: AppShellValue];
}>();
defineSlots<{
default?: () => unknown;
logo?: () => unknown;
"rail-extra"?: () => unknown;
}>();
// ---------- 布局上下文 ----------
const layout = createLayoutContext({
tablet: props.tablet,
tabletMin: props.tabletMin,
wideMin: props.wideMin,
railOnPortrait: props.railOnPortrait,
mode: props.mode
});
provideLayout(layout);
const { railVisible } = layout;
const itemList = computed(() => props.items ?? []);
/** 左侧导航栏常驻,仅受 hide-rail 控制。 */
const showRail = computed(() => railVisible.value && itemList.value.length > 0 && !props.hideRail);
/** 悬浮模式下保留节点交给过渡,贴底模式下直接移除。 */
const showTabBar = computed(() => !railVisible.value
&& itemList.value.length > 0
&& (props.tabBarFloat || !props.hideNav));
// ---------- 尺寸变量 ----------
function toSize(value: number | string | undefined, fallback: string): string {
if (value === undefined || value === "") {
return fallback;
}
return typeof value === "number" ? `${value}px` : value;
}
const railWidthValue = computed(() => toSize(props.railWidth, "96px"));
const tabBarHeightValue = computed(() => toSize(props.tabBarHeight, "52px"));
const shellStyle = computed<StyleValue>(() => ({
"--tui-rail-width": railWidthValue.value,
"--tui-tabbar-height": tabBarHeightValue.value,
"--tui-fixed-left": showRail.value ? railWidthValue.value : "0px",
"--tui-transition-inset-left": showRail.value ? railWidthValue.value : "0px"
}));
// ---------- 导航 ----------
async function requestChange(next: AppShellValue): Promise<void> {
if (next === props.modelValue) {
return;
}
if (props.beforeChange) {
const allowed = await props.beforeChange(next);
if (allowed === false) {
return;
}
}
emit("update:modelValue", next);
emit("change", next);
}
function onSelect(item: AppShellItem): void {
if (item.disabled) {
return;
}
void requestChange(item.value);
}
function onTabChange(value: AppShellValue): void {
const target = itemList.value.find(item => item.value === value);
if (!target || target.disabled) {
return;
}
void requestChange(value);
}
</script>
<style scoped lang="less">
.tui-app-shell {
height: 100vh;
height: 100dvh;
display: flex;
overflow: hidden;
position: relative;
color: var(--td-text-color-primary);
background: var(--td-bg-color-page);
.body {
flex: 1;
display: flex;
min-width: 0;
flex-direction: column;
}
.content {
flex: 1;
position: relative;
min-height: 0;
overflow: hidden;
}
.rail {
width: var(--tui-rail-width);
flex: none;
z-index: 10;
display: flex;
position: relative;
overflow-y: auto;
flex-direction: column;
padding-left: env(safe-area-inset-left, 0);
border-right: 1px solid var(--td-component-border);
background: var(--tui-rail-background, var(--td-bg-color-container));
.logo {
height: 4.5rem;
display: grid;
font-weight: 600;
place-items: center;
font-size: var(--tui-rail-logo-font-size, 1.25rem);
}
.rail-item {
--td-button-border-radius: var(--tui-rail-item-radius, .75rem);
width: calc(100% - 1.25rem);
height: auto;
display: flex;
margin: .125rem .625rem;
padding: var(--tui-rail-item-padding, .75rem 0);
color: var(--td-text-color-secondary);
font-size: var(--tui-rail-item-font-size, .75rem);
line-height: 1.4;
flex-direction: column;
:deep(.t-button__content) {
gap: .25rem;
display: flex;
align-items: center;
flex-direction: column;
}
&.on {
color: var(--tui-rail-active-color, var(--td-brand-color));
font-weight: 600;
background: var(--tui-rail-active-background, var(--td-brand-color-light));
}
}
.rail-extra {
margin-top: auto;
padding-bottom: calc(.75rem + env(safe-area-inset-bottom, 0));
}
}
.tabbar {
--td-tab-bar-height: var(--tui-tabbar-height);
--td-tab-bar-bg-color: var(--tui-tabbar-background, var(--td-bg-color-container));
flex: none;
border-top: 1px solid var(--td-component-border);
padding-bottom: env(safe-area-inset-bottom, 0);
background: var(--tui-tabbar-background, var(--td-bg-color-container));
:deep(.t-tab-bar-item) {
margin: 0;
}
:deep(.is-disabled) {
opacity: .4;
pointer-events: none;
}
&.is-float {
--td-tab-bar-active-bg: var(--tui-tabbar-active-background, var(--td-brand-color-light));
--td-tab-bar-bg-color: transparent;
left: var(--tui-tabbar-float-inset, 1rem);
right: var(--tui-tabbar-float-inset, 1rem);
bottom: var(--tui-tabbar-float-inset, 1rem);
z-index: 2;
margin: 0;
opacity: 1;
position: fixed;
border-top: 0;
padding-bottom: 0;
border-radius: var(--tui-tabbar-float-radius, 99rem);
box-shadow: var(--td-shadow-3);
background: var(--tui-tabbar-float-background, color-mix(in srgb, var(--td-bg-color-container) 60%, transparent));
backdrop-filter: blur(var(--tui-tabbar-float-blur, 10px));
-webkit-backdrop-filter: blur(var(--tui-tabbar-float-blur, 10px));
transform: translateY(0);
pointer-events: auto;
transition: opacity var(--tui-tabbar-float-duration, 520ms), transform var(--tui-tabbar-float-duration, 520ms) var(--tui-bezier, cubic-bezier(.19, 1, .22, 1));
&.is-hidden {
opacity: 0;
pointer-events: none;
transform: translateY(calc(100% + var(--tui-tabbar-float-inset, 1rem)));
}
:deep(.t-tab-bar-item) {
margin: 4px 0;
padding: 0 4px;
}
}
}
}
</style>
+42
View File
@@ -0,0 +1,42 @@
import type { AppShellLayoutOptions } from "../../composables/use-layout";
export type { AppShellLayoutOptions, AppShellMode } from "../../composables/use-layout";
/** 导航值,支持字符串或数字。 */
export type AppShellValue = string | number;
/** 一级导航项。 */
export interface AppShellItem {
/** 唯一值,通常传路由 path。 */
value: AppShellValue;
/** 显示文字。 */
text: string;
/** TDesign 图标名;不传时只显示文字。 */
icon?: string;
/** 是否禁用。 */
disabled?: boolean;
/** 角标内容,通常是未读数;传 0 或空字符串时不显示。 */
badge?: string | number;
}
/** AppShell 组件属性。 */
export interface AppShellProps extends AppShellLayoutOptions {
/** 一级导航项;不传时只渲染内容区。 */
items?: AppShellItem[];
/** 当前激活的导航值。 */
modelValue?: AppShellValue;
/** 左侧导航栏顶部的标识文字,通常放一个字符。 */
logoText?: string;
/** 是否隐藏底部标签栏;默认 false。左侧导航栏不受影响,需要时配合 hide-rail 使用。 */
hideNav?: boolean;
/** 是否隐藏左侧导航栏;默认 false,用于全屏看图、沉浸阅读等场景。 */
hideRail?: boolean;
/** 底部标签栏是否悬浮显示;默认 false,贴底铺满。 */
tabBarFloat?: boolean;
/** 左侧导航栏宽度,数字以 px 为单位,默认 96。 */
railWidth?: number | string;
/** 底部标签栏高度,数字以 px 为单位,默认 52。 */
tabBarHeight?: number | string;
/** 切换前拦截,返回 false 时取消本次切换。 */
beforeChange?: (value: AppShellValue) => boolean | Promise<boolean>;
}
+28
View File
@@ -1,6 +1,10 @@
/** 导出所有组件 */
import RootLayout from "./root-layout";
import PageTransition from "./page-transition";
import AppShell from "./app-shell";
import MasterDetail from "./master-detail";
import MasterDetailPage from "./master-detail-page";
import PaneTransition from "./pane-transition";
import DurationPicker from "./duration-picker";
import CodeEditor from "./code-editor";
import TiptapEditor from "./tiptap-editor";
@@ -23,6 +27,10 @@ import {
export default [
RootLayout,
PageTransition,
AppShell,
MasterDetail,
MasterDetailPage,
PaneTransition,
DurationPicker,
CodeEditor,
TiptapEditor,
@@ -44,6 +52,10 @@ export default [
export {
RootLayout,
PageTransition,
AppShell,
MasterDetail,
MasterDetailPage,
PaneTransition,
DurationPicker,
CodeEditor,
TiptapEditor,
@@ -62,6 +74,22 @@ export {
AiChatThinking
};
export { createLayoutContext, provideLayout, useLayout } from "./app-shell";
export { useExpandToMaster, useMasterDetail, useMasterDetailPane, usePane } from "../composables/use-master-detail";
export type { ExpandToMasterOptions, PaneContext, PaneDirection, UseMasterDetailOptions, UseMasterDetailPaneOptions, UseMasterDetailPaneReturn, UseMasterDetailReturn } from "../composables/use-master-detail";
export type {
AppShellItem,
AppShellLayoutOptions,
AppShellMode,
AppShellProps,
AppShellValue,
LayoutContext
} from "./app-shell";
export type { MasterDetailProps } from "./master-detail";
export type { MasterDetailPageProps } from "./master-detail-page";
export {
AiChatHttpError,
AiChatStreamError,
@@ -0,0 +1,7 @@
import view from "./index.vue";
import { WebToolkit } from "timi-web";
export const MasterDetailPage = WebToolkit.withInstall(view);
export default MasterDetailPage;
export type { MasterDetailPageProps } from "./type";
@@ -0,0 +1,79 @@
<template>
<main class="tui-page-content tui-master-detail-page" :class="split ? 'is-split' : 'scroll column'">
<master-detail
:split="split"
:master-width="masterWidth"
:top-inset="topInset"
:detail-empty="!selected"
>
<template #master>
<div class="tui-master-wrap">
<slot name="master" />
</div>
</template>
<template #detail>
<!--
外层 v-if 而不是让 PaneTransition 处理"从空到有":
选中时右栏是从 0 宽度长出来的,内容应该一开始就贴着主栏,
跟着宽度被"拉开"。交给 PaneTransition 会从 translateX(100%)
滑进来,看起来像详情从右边追上来。
-->
<pane-transition v-if="selected" :direction="direction">
<slot name="detail" />
</pane-transition>
</template>
</master-detail>
</main>
</template>
<script setup lang="ts">
import { computed } from "vue";
import MasterDetail from "../master-detail/index.vue";
import PaneTransition from "../pane-transition/index.vue";
import { useLayout } from "../../composables/use-layout";
import type { MasterDetailPageProps } from "./type";
defineOptions({
name: "MasterDetailPage"
});
const props = withDefaults(defineProps<MasterDetailPageProps>(), {
split: "auto",
selected: false,
direction: "forward",
masterWidth: 380,
topInset: ""
});
defineSlots<{
master?: () => unknown;
detail?: () => unknown;
}>();
const layout = useLayout({ tablet: true });
const split = computed(() => (props.split === "auto" ? layout.isWide.value : props.split));
</script>
<style scoped lang="less">
.tui-master-detail-page {
/**
* 分栏时内容区不再自己滚动:高度由两栏分配,滚动交给主栏里的列表容器。
* 顶部的导航间距也因此交给列表容器自己加(见 page-layout.less 的 .list 约定)。
*/
&.is-split {
overflow: hidden;
padding-top: 0;
padding-bottom: 0;
}
// 让内部的下拉刷新/列表接管滚动,主栏只负责宽度
.tui-master-wrap {
height: 100%;
display: flex;
min-height: 0;
flex-direction: column;
}
}
</style>
+19
View File
@@ -0,0 +1,19 @@
import type { PaneDirection } from "../../composables/use-master-detail";
/** MasterDetailPage 的 props。 */
export interface MasterDetailPageProps {
/**
* 是否分栏。
*
* 传 `"auto"` 时跟随 AppShell 的横屏状态;业务自己判断时传布尔值。
*/
split?: boolean | "auto";
/** 右栏是否有内容。为 false 时主栏占满整宽,右栏不渲染。 */
selected?: boolean;
/** 右栏切换方向,直接来自 `useMasterDetailPane` 的 `paneDirection`。 */
direction?: PaneDirection;
/** 主栏宽度,默认 380。 */
masterWidth?: number | string;
/** 主栏顶部让出的高度,通常不需要传。 */
topInset?: string;
}
+7
View File
@@ -0,0 +1,7 @@
import view from "./index.vue";
import { WebToolkit } from "timi-web";
export const MasterDetail = WebToolkit.withInstall(view);
export default MasterDetail;
export type { MasterDetailProps } from "./type";
+153
View File
@@ -0,0 +1,153 @@
<template>
<div
class="tui-master-detail"
:class="{ split: isSplit, 'is-collapsed': isSplit && detailEmpty }"
:style="rootStyle"
>
<section class="master">
<slot name="master" />
</section>
<section v-if="isSplit" class="detail">
<slot name="detail">
<div v-if="emptyText && !detailEmpty" class="empty">
<center-tips :content="emptyText" />
</div>
</slot>
</section>
</div>
</template>
<script setup lang="ts">
import { computed, type StyleValue } from "vue";
import { CenterTips } from "timi-web";
import { useLayout } from "../../composables/use-layout";
import type { MasterDetailProps } from "./type";
defineOptions({
name: "MasterDetail"
});
const props = withDefaults(defineProps<MasterDetailProps>(), {
masterWidth: 380,
split: "auto",
emptyText: "",
topInset: "",
detailEmpty: false
});
defineSlots<{
master?: () => unknown;
detail?: () => unknown;
}>();
// ---------- 分栏判定 ----------
const layout = useLayout({ tablet: true });
/** split 为 auto 时跟随 AppShell 的横屏状态,显式传入布尔值时以业务为准。 */
const isSplit = computed(() => (props.split === "auto" ? layout.isWide.value : props.split));
// ---------- 尺寸 ----------
const rootStyle = computed<StyleValue>(() => ({
"--tui-master-width": typeof props.masterWidth === "number"
? `${props.masterWidth}px`
: props.masterWidth,
...(props.topInset ? { "--tui-master-top-inset": props.topInset } : {})
}));
</script>
<style scoped lang="less">
@easing: var(--tui-bezier, cubic-bezier(.19, 1, .22, 1));
.tui-master-detail {
flex: 1;
height: 100%;
display: flex;
min-height: 0;
.master {
flex: 1;
min-width: 0;
position: relative;
overflow-y: auto;
padding-top: var(--tui-master-top-inset, 0px);
-webkit-overflow-scrolling: touch;
}
.empty {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
&.split {
.master {
flex: none;
width: var(--tui-master-width);
box-sizing: border-box;
// 宽度过渡期间列表会被压窄,内容可能横向溢出,裁掉避免压到详情栏上
overflow-x: hidden;
border-right: 1px solid var(--td-component-border, rgba(0, 0, 0, .08));
// 时长和曲线都来自 page-layout.less 的变量,列表页导航栏用同一组,
// 两边必须同拍,否则列表跳、导航滑。
transition: width var(--tui-split-duration, 320ms) @easing, border-color .2s linear;
}
.detail {
flex: 1;
min-width: 0;
position: relative;
overflow-x: hidden;
overflow-y: auto;
padding-top: var(--tui-master-top-inset, 0px);
background: var(--tui-master-detail-background, var(--td-bg-color-page));
-webkit-overflow-scrolling: touch;
// 展开方向不加 opacity 过渡:
// 宽度从 0 长出来本身就是"揭示",再叠一层淡入会让内容看着迟迟不出现。
// 收起方向的淡出定义在 .is-collapsed 里,只在收起时生效。
/**
* 详情栏里放的整页组件自动适配栏位:贴合高度、建立定位上下文。
* 导航栏不隐藏,而是由 page-layout.less 退化成栏内头部,
* 这样编辑等操作仍然可用。
*/
:deep(.tui-page-layout) {
height: 100%;
position: relative;
min-height: 0;
}
}
/**
* 未选中详情:主栏占满,右栏收起。
*
* 详情栏不设 display: none——那样宽度变化就没有过渡了。
* 保持 flex 分配、把宽度压到 0,配合 overflow-x: hidden 裁掉内容,
* 主栏宽度一过渡,右栏自然被"挤"出来。
*/
&.is-collapsed {
.master {
width: 100%;
border-right-color: transparent;
}
.detail {
// 收起方向:内容比宽度先淡出。
// 否则右栏被压到只剩几十像素时,文字会挤成竖排、按钮会卡在角上,
// 看起来像残影而不是"被推走"。
//
// transition 只写在这里:展开时 class 被移除,属性回到默认的瞬间切换,
// 内容第一帧就是可见的。
opacity: 0;
overflow-y: hidden;
pointer-events: none;
transition: opacity .12s ease-out;
}
}
}
}
</style>
+25
View File
@@ -0,0 +1,25 @@
/** MasterDetail 组件属性。 */
export interface MasterDetailProps {
/** 主栏宽度,数字以 px 为单位,默认 380。 */
masterWidth?: number | string;
/** 是否分栏;auto 时跟随 AppShell 的横屏状态,默认 auto。 */
split?: boolean | "auto";
/** 分栏且详情为空时显示的文案。 */
emptyText?: string;
/**
* 两栏顶部的内边距,通常填导航栏高度。
*
* 加在两栏自己的滚动容器上,内容滚动时才能穿到 fixed 导航栏的毛玻璃层下面;
* 加在外层容器上只会把内容整体下移,滚不动。
*/
topInset?: string;
/**
* 详情栏当前是否为空,默认 false。
*
* 传 true 时主栏占满宽度、详情栏收起,选中后主栏收缩到 master-width、右栏展开。
* 适合"先看列表、选中再展开"的平板场景:空白右栏不占位,列表也不用挤在 380 的窄条里。
*
* 只有卡片式列表适合打开——多列宽表格从满宽压到 master-width 会挤成一团。
*/
detailEmpty?: boolean;
}
+6 -11
View File
@@ -1,8 +1,5 @@
<template>
<div
class="page-transition"
:class="{ 'page-transition-reduced-motion': props.respectReducedMotion }"
>
<div class="page-transition">
<RouterView v-slot="{ Component, route }">
<Transition
:name="transitionName"
@@ -81,10 +78,6 @@ const props = defineProps({
},
transitionMode: String as PropType<PageTransitionProps["transitionMode"]>,
appear: Boolean,
respectReducedMotion: {
type: Boolean,
default: true
},
keepAlive: {
type: [Boolean, Function] as PropType<PageTransitionProps["keepAlive"]>,
default: false
@@ -227,7 +220,7 @@ onUnmounted(() => {
</script>
<style scoped lang="less">
@easing: cubic-bezier(.19, 1, .22, 1);
@easing: var(--tui-bezier, cubic-bezier(.19, 1, .22, 1));
@duration: 520ms;
@brightness: .98;
@shadow-intensity: .15;
@@ -255,8 +248,10 @@ onUnmounted(() => {
:deep(.push-left-leave-active),
:deep(.push-right-enter-active),
:deep(.push-right-leave-active) {
width: 100%;
height: 100%;
// 转场期间页面脱离文档流铺满视口,用 inset 让出应用外壳的导航区域
inset: var(--tui-transition-inset-top, 0) 0 0 var(--tui-transition-inset-left, 0);
width: auto;
height: auto;
position: fixed;
transition: transform @duration @easing, opacity .2s linear;
backface-visibility: hidden;
-2
View File
@@ -34,8 +34,6 @@ export interface PageTransitionProps {
transitionMode?: "out-in" | "in-out";
/** 是否在首次渲染时播放过渡。 */
appear?: boolean;
/** 是否尊重系统的减少动态效果设置,默认开启。 */
respectReducedMotion?: boolean;
/** 是否缓存页面,也可以按路由决定。默认不缓存。 */
keepAlive?: PageTransitionKeepAliveMatcher;
/** keep-alive 最多保留的页面数量。 */
+5
View File
@@ -0,0 +1,5 @@
import view from "./index.vue";
import { WebToolkit } from "timi-web";
export const PaneTransition = WebToolkit.withInstall(view);
export default PaneTransition;
+92
View File
@@ -0,0 +1,92 @@
<template>
<transition :name="transitionName" :css="direction !== 'none'">
<slot />
</transition>
</template>
<script setup lang="ts">
import { computed } from "vue";
import type { PaneDirection } from "../../composables/use-master-detail";
defineOptions({
name: "PaneTransition"
});
const props = withDefaults(defineProps<{
/**
* 切换方向。
*
* - forward:新内容从右侧推入,旧内容左移让位(进入下一层,如详情 → 编辑)
* - back:新内容从左侧覆盖回来,旧内容滑出右侧(返回上一层)
* - none:同级内容替换(换一个客户),直接切换不做动画
*/
direction?: PaneDirection;
}>(), {
direction: "forward"
});
defineSlots<{
default?: () => unknown;
}>();
const transitionName = computed(() => `tui-pane-${props.direction}`);
</script>
<style lang="less">
/**
* 栏内推入/推出效果,与 PageTransition 的 push-left / push-right 同源,
* 区别是容器从视口换成了栏位:定位用 absolute 而非 fixed,时长略短。
*
* 这里不能用 scoped:过渡类是由 Vue 加到插槽内容上的,scoped 命中不了。
*/
@duration: 420ms;
@easing: var(--tui-bezier, cubic-bezier(.19, 1, .22, 1));
@offset: 25%;
@shadow: -4px 0 16px rgba(0, 0, 0, .15);
// forward:新内容从右侧推入,旧内容左移
.tui-pane-forward-enter-active,
.tui-pane-forward-leave-active {
position: absolute !important;
inset: 0;
transition: transform @duration @easing, opacity .2s linear;
backface-visibility: hidden;
}
.tui-pane-forward-enter-from {
box-shadow: @shadow;
transform: translate3d(100%, 0, 0);
}
.tui-pane-forward-leave-to {
filter: brightness(.98);
transform: translate3d(-@offset, 0, 0);
}
// back:新内容从左侧覆盖回来,旧内容滑出右侧
.tui-pane-back-enter-active,
.tui-pane-back-leave-active {
position: absolute !important;
inset: 0;
transition: transform @duration @easing;
backface-visibility: hidden;
}
.tui-pane-back-enter-active {
z-index: 0;
}
.tui-pane-back-enter-from {
transform: translate3d(-@offset, 0, 0);
}
.tui-pane-back-leave-active {
z-index: 1;
transition: transform @duration @easing, box-shadow .3s;
}
.tui-pane-back-leave-to {
box-shadow: @shadow;
transform: translate3d(100%, 0, 0);
}
</style>