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

76 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>
<div>
<a-input-search
v-model:value="value"
placeholder="input search text"
style="width: 200px"
@search="onSearch"
/>
<br />
<br />
<a-input-search
v-model:value="value"
placeholder="input search text"
enter-button
@search="onSearch"
/>
<br />
<br />
<a-input-search
v-model:value="value"
placeholder="input search text"
enter-button="Search"
size="large"
@search="onSearch"
/>
<br />
<br />
<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>
</div>
</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>