feat(app-shell): add rail click
This commit is contained in:
@@ -61,6 +61,8 @@ async function onChangeTab(value: string) {
|
||||
|
||||
`AppShell` 只负责导航形态与容器尺寸,不接管路由。`v-model` 与 `change` 都只是把点击结果交回业务,跳不跳、跳去哪里由业务决定。
|
||||
|
||||
点击未禁用的左侧导航项时,`rail-click` 会传出该项的值,包括已激活的导航项。该事件表示点击,不受 `before-change` 控制;切换是否被允许仍由 `before-change` 和 `change` 决定。
|
||||
|
||||
## 平板布局
|
||||
|
||||
`tablet` 默认 `true`——引入 `AppShell` 就意味着要手机和平板两端。真有项目只需要容器能力、暂不响应式,传 `:tablet="false"` 即可退回纯手机布局。
|
||||
|
||||
@@ -90,6 +90,7 @@ const props = withDefaults(defineProps<AppShellProps>(), {
|
||||
const emit = defineEmits<{
|
||||
"update:modelValue": [value: AppShellValue];
|
||||
"change": [value: AppShellValue];
|
||||
"rail-click": [value: AppShellValue];
|
||||
}>();
|
||||
|
||||
defineSlots<{
|
||||
@@ -164,6 +165,7 @@ function onSelect(item: AppShellItem): void {
|
||||
return;
|
||||
}
|
||||
|
||||
emit("rail-click", item.value);
|
||||
void requestChange(item.value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user