164 lines
5.3 KiB
Vue
164 lines
5.3 KiB
Vue
<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" &&
|
||
new URLSearchParams(window.location.search).has("overlay-animation");
|
||
import OverlayLab from "./OverlayLab.vue";
|
||
import OverlayComponentsLab from "./OverlayComponentsLab.vue";
|
||
const componentsLab =
|
||
typeof window !== "undefined" &&
|
||
new URLSearchParams(window.location.search).has("overlay-components");
|
||
const overlayLab =
|
||
typeof window !== "undefined" &&
|
||
new URLSearchParams(window.location.search).has("overlay-lab");
|
||
import { Button, Card, Input, Switch } from "@heroui-vue/components";
|
||
const dark = ref(false),
|
||
notifications = ref(true),
|
||
name = ref("设计团队"),
|
||
saved = ref(false),
|
||
count = ref(0);
|
||
function save() {
|
||
saved.value = true;
|
||
}
|
||
</script>
|
||
<template>
|
||
<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'">
|
||
<header>
|
||
<a class="wordmark" href="#">
|
||
hero
|
||
<span>ui</span>
|
||
<small>Vue</small>
|
||
</a>
|
||
<nav>
|
||
<a href="#components">组件预览</a>
|
||
<a href="#start">开始使用</a>
|
||
</nav>
|
||
<label class="theme">
|
||
深色模式
|
||
<Switch v-model:checked="dark" aria-label="深色模式" />
|
||
</label>
|
||
</header>
|
||
<main>
|
||
<section class="intro">
|
||
<p class="release">Vue 3 组件库 · 开发预览</p>
|
||
<h1>
|
||
熟悉的设计,
|
||
<br />
|
||
自然的 Vue 体验。
|
||
</h1>
|
||
<p class="lead">
|
||
从一颗按钮开始,让每一个细节都有章可循。
|
||
<br />
|
||
在这里试试第一批组件。
|
||
</p>
|
||
<a class="text-link" href="#components">探索组件 ↓</a>
|
||
</section>
|
||
<section id="components" class="workbench">
|
||
<div class="section-title">
|
||
<h2>组件实验室</h2>
|
||
<span>4 个组件 · 起步阶段</span>
|
||
</div>
|
||
<div class="grid">
|
||
<Card class="button-demo">
|
||
<div class="demo-title">
|
||
<h3>Button</h3>
|
||
<span>动作与反馈</span>
|
||
</div>
|
||
<div class="samples">
|
||
<Button @click="count++">
|
||
点击试试
|
||
<span aria-live="polite">{{ count }}</span>
|
||
</Button>
|
||
<Button variant="secondary">次要操作</Button>
|
||
<Button variant="outline">描边按钮</Button>
|
||
<Button variant="ghost">轻量操作</Button>
|
||
<Button variant="danger">危险操作</Button>
|
||
<Button disabled>不可用</Button>
|
||
</div>
|
||
<p class="caption">圆角、尺寸、状态,保持一致的触感。</p>
|
||
</Card>
|
||
<Card>
|
||
<div class="demo-title">
|
||
<h3>工作区设置</h3>
|
||
<span>Input + Switch</span>
|
||
</div>
|
||
<form @submit.prevent="save">
|
||
<label class="field">
|
||
工作区名称
|
||
<Input
|
||
v-model="name"
|
||
name="workspace"
|
||
required
|
||
@input="saved = false"
|
||
/>
|
||
</label>
|
||
<div class="setting">
|
||
<div>
|
||
<label for="notifications">活动通知</label>
|
||
<p>接收工作区的重要更新</p>
|
||
</div>
|
||
<Switch
|
||
id="notifications"
|
||
v-model:checked="notifications"
|
||
name="notifications"
|
||
/>
|
||
</div>
|
||
<Button type="submit" full-width>保存设置</Button>
|
||
<p class="feedback" role="status">
|
||
{{
|
||
saved
|
||
? `已保存「${name}」的设置`
|
||
: "修改后点击保存,试试双向绑定。"
|
||
}}
|
||
</p>
|
||
</form>
|
||
</Card>
|
||
<Card variant="secondary" class="card-demo">
|
||
<div class="demo-title">
|
||
<h3>Card</h3>
|
||
<span>内容的容器</span>
|
||
</div>
|
||
<div class="swatches">
|
||
<i />
|
||
<i />
|
||
<i />
|
||
<i />
|
||
</div>
|
||
<h4>
|
||
为你的下一次创作
|
||
<br />
|
||
留一块画布。
|
||
</h4>
|
||
<p>主题变量与组件样式独立维护,让定制从容一点。</p>
|
||
<Button variant="outline" @click="dark = !dark">切换主题</Button>
|
||
</Card>
|
||
</div>
|
||
</section>
|
||
<section id="start" class="start">
|
||
<div>
|
||
<h2>从这里开始</h2>
|
||
<p>本地开发预览,组件仍在持续完善。</p>
|
||
</div>
|
||
<code>
|
||
pnpm install
|
||
<br />
|
||
pnpm dev
|
||
</code>
|
||
</section>
|
||
<footer>
|
||
<span>HeroUI Vue · 独立社区实现</span>
|
||
<span>以 HeroUI v3 为设计参考</span>
|
||
</footer>
|
||
</main>
|
||
</div>
|
||
</template>
|