58 lines
1.7 KiB
Vue
58 lines
1.7 KiB
Vue
<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>
|