Vue前端页面实现搜索框的重置
信息系统里面会设计页面展示数据库里的信息,然后一定会设置搜索的功能,搜索包含下拉框或者输入框,然后搜索完要清空搜索栏并且让页面显示完整的数据,今天让我们完成这个功能。
<template>
<a-input
v-model:value = "input.name"
class=""
placehoder="请输入姓名进行搜索"
>
<a-button shape="circle" @click="reset" size="large">
<template #icon>
<UndoOutlined/>
</template>
</a-button>
</template>
<script>
import {UndoOutlined} from "@ant-design/icons-vue";
//在data的return里面定义input的内容
input:{name:undefined},
components:{UndoOutlined},
//然后在methods里面定义reset方法
reset(){
this.input.name='';
this.获取所有数据的方法();
},
</script>
step1:写好input和button按钮的内容
step2:定义一下name,不赋值的时候都写undefined
step3:记得写上components
step4:编写函数reset,让输入值变空