# yuSearch 实时搜索组件
实时搜索查询组件,实现边搜索边查询,包含防抖或节流实现
# 效果预览
# 示例代码
<template>
<yu-search @search="searchFn" :delay="1000" delayType="throttle"></yu-search>
<template>
<script>
import yuSearch from '@/components/yu-search/index.vue';
export default {
components: {
yuSearch
},
data() {
},
methods: {
searchFn(value) {
console.log('页面查询触发', value);
}
},
}
</script>
# Attributes
参数 | 说明 | 类型 | 可选值 | 默认值 |
---|---|---|---|---|
placeholder | 搜索框提示 | string | - | 请输入搜索关键字 |
val | 所搜框的默认值 | string | - | - |
delay | 延迟搜索时间,单位毫秒 | string | - | 2000 |
delayType | 延迟搜索类型,节流、防抖 | string | debounce-防抖,throttle-节流 | debounce |
# Events
方法名 | 说明 | 参数 |
---|---|---|
search | 查询回调触发 | value 当前搜索框的值 |
blur | 查询框失去焦点 | value 当前搜索框的值 |