feat: migrate ScrollShadow and Tabs with docs and keyboard support
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import ScrollTabsLab from "./ScrollTabsLab.vue";
|
||||
const scrollTabsLab =
|
||||
typeof window !== "undefined" &&
|
||||
new URLSearchParams(window.location.search).has("scroll-tabs");
|
||||
import OverlayAnimationLab from "./OverlayAnimationLab.vue";
|
||||
const animationLab =
|
||||
typeof window !== "undefined" &&
|
||||
@@ -23,7 +27,8 @@ function save() {
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<OverlayAnimationLab v-if="animationLab" />
|
||||
<ScrollTabsLab v-if="scrollTabsLab" />
|
||||
<OverlayAnimationLab v-else-if="animationLab" />
|
||||
<OverlayComponentsLab v-else-if="componentsLab" />
|
||||
<OverlayLab v-else-if="overlayLab" />
|
||||
<div v-else class="lab" :data-theme="dark ? 'dark' : 'light'">
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import {
|
||||
Button,
|
||||
ScrollShadow,
|
||||
Tabs,
|
||||
TabsListContainer,
|
||||
TabsList,
|
||||
TabsTab,
|
||||
TabsPanel,
|
||||
TabsIndicator,
|
||||
} from "@heroui-vue/components";
|
||||
const dir = ref<"ltr" | "rtl">("ltr"),
|
||||
orientation = ref<"horizontal" | "vertical">("horizontal"),
|
||||
count = ref(1);
|
||||
const keys = Array.from({ length: 12 }, (_, i) => `tab-${i + 1}`);
|
||||
</script>
|
||||
<template>
|
||||
<main class="p-8 flex flex-col gap-6">
|
||||
<h1>ScrollShadow / Tabs 集成回归</h1>
|
||||
<div class="flex gap-4">
|
||||
<Button @click="dir = dir === 'ltr' ? 'rtl' : 'ltr'">切换 RTL</Button>
|
||||
<Button
|
||||
@click="
|
||||
orientation = orientation === 'horizontal' ? 'vertical' : 'horizontal'
|
||||
"
|
||||
>
|
||||
切换方向
|
||||
</Button>
|
||||
<Button @click="count = count === 1 ? 12 : 1">切换内容数量</Button>
|
||||
</div>
|
||||
<output>{{ dir }} / {{ orientation }} / {{ count }}</output>
|
||||
<Tabs :dir="dir" :orientation="orientation" class="w-full max-w-xl">
|
||||
<TabsListContainer
|
||||
:class="orientation === 'horizontal' ? 'w-[320px]' : 'h-[160px] w-32'"
|
||||
>
|
||||
<TabsList aria-label="方向溢出">
|
||||
<TabsTab v-for="key in keys" :key="key" :value="key">
|
||||
{{ key }}
|
||||
<TabsIndicator />
|
||||
</TabsTab>
|
||||
</TabsList>
|
||||
</TabsListContainer>
|
||||
<TabsPanel v-for="key in keys" :key="key" :value="key">
|
||||
{{ key }} 内容
|
||||
</TabsPanel>
|
||||
</Tabs>
|
||||
<ScrollShadow
|
||||
class="h-32 w-64"
|
||||
tabindex="0"
|
||||
role="region"
|
||||
aria-label="动态滚动内容"
|
||||
>
|
||||
<p v-for="i in count" :key="i" class="h-12">段落 {{ i }}</p>
|
||||
</ScrollShadow>
|
||||
</main>
|
||||
</template>
|
||||
Reference in New Issue
Block a user