feat: master-detail third pane

- MasterDetail / MasterDetailPage: add `sub` prop and `#sub` slot. The three
  columns share one container and are placed by left/right, so the detail pane
  moves between columns without remounting and keeps its scroll position.
- useMasterDetailPane: add subView / openSub / closeSub, keep the sub view in
  query and browser history alongside detail and view.
- page-layout: sub pane reuses the in-pane navbar rules; the list navbar slides
  out on the third level instead of being hidden.
- docs: demos for the third pane, the layered navbars and PaneTransition;
  restore transition durations in demo previews under prefers-reduced-motion,
  where VitePress zeroes them. Fix the missing `split` ref in the master-detail
  demo and the incorrect note about the back arrow.
This commit is contained in:
Timi
2026-11-11 23:55:30 +08:00
parent 81bbbc0662
commit ba0c7bf9a2
14 changed files with 1185 additions and 85 deletions
+9
View File
@@ -19,6 +19,12 @@
把需要切换的内容放进默认插槽,每个分支带唯一 `key`,用 `direction` 指定方向:
:::preview 三个方向 || 按钮切换视图,注意进入和返回时内容从哪一侧进出
demo-preview=../demos/pane-transition/basic.vue
:::
```vue
<template #detail>
<pane-transition :direction="direction">
@@ -49,6 +55,9 @@ function onClose(): void {
方向由业务决定,组件不猜。**同级换内容用 `none`**——列表里换一个客户、换一条记录,内容和布局都没变,只是数据换了,滑动会让人以为"进了下一层"。`useMasterDetailPane` 已经把这条处理好了:右栏已有内容时换项自动用 `none`,只有进编辑才用 `forward`。
用它搭多层界面时不用手写这一层:`MasterDetailPage` 的 `#detail` 和 `#sub` 槽已经接好了,
方向来自 `useMasterDetailPane` 的 `paneDirection`。
## 两个实现细节
**过渡期间旧视图是 `absolute`**,不占位。否则新旧两个视图会在栏位里上下排列,高度瞬间翻倍。