You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/input/demo/search-input.vue

70 lines
1.3 KiB

<docs>
---
order: 3
title:
zh-CN: 搜索框
en-US: Search box
---
## zh-CN
带有搜索按钮的输入框
## en-US
Example of creating a search box by grouping a standard input with a search button.
</docs>
<template>
<a-space direction="vertical">
<a-input-search
v-model:value="value"
placeholder="input search text"
style="width: 200px"
@search="onSearch"
/>
<a-input-search
v-model:value="value"
placeholder="input search text"
enter-button
@search="onSearch"
/>
<a-input-search
v-model:value="value"
placeholder="input search text"
enter-button="Search"
size="large"
@search="onSearch"
/>
<a-input-search
v-model:value="value"
placeholder="input search text"
size="large"
@search="onSearch"
>
<template #enterButton>
<a-button>Custom</a-button>
</template>
</a-input-search>
</a-space>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
export default defineComponent({
setup() {
const value = ref<string>('');
const onSearch = (searchValue: string) => {
console.log('use value', searchValue);
console.log('or use this.value', value.value);
};
return {
value,
onSearch,
};
},
});
</script>