Files
heroui-vue/apps/docs/demos/search-field-controlled.vue
T
2026-10-22 08:46:02 +08:00

33 lines
890 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import {
SearchFieldClearButton,
SearchFieldSearchIcon,
SearchFieldGroup,
SearchFieldInput,
SearchField,
Label,
Description,
Button,
} from "@heroui-vue/components";
import { ref } from "vue";
const value = ref("");
</script>
<template>
<div class="flex flex-col gap-4">
<SearchField v-model="value" name="search">
<Label>搜索</Label>
<SearchFieldGroup>
<SearchFieldSearchIcon />
<SearchFieldInput class="w-[280px]" placeholder="搜索…" />
<SearchFieldClearButton />
</SearchFieldGroup>
<Description>当前值: {{ value || "(空)" }}</Description>
</SearchField>
<div class="flex gap-2">
<Button variant="tertiary" @click="value = ''">Clear</Button>
<Button variant="tertiary" @click="value = '示例查询'">设置示例</Button>
</div>
</div>
</template>