| | |
| | | import styles from './Search.module.scss' |
| | | import Icon from '../Icon/Icon' |
| | | import { useVModel } from '@vueuse/core' |
| | | import { debounce } from 'lodash' |
| | | import debounce from 'lodash/debounce' |
| | | import { _t, t } from '@/libs/Language/Language' |
| | | |
| | | export default defineComponent({ |
| | | name: '搜索输入', |
| | | props: { |
| | |
| | | emits: ['confirm', 'update:modelValue'], |
| | | setup(props, { attrs, slots, emit }) { |
| | | const innerValue = useVModel(props) |
| | | return () => { |
| | | const confirm = (event: KeyboardEvent | string) => { |
| | | if ( |
| | | typeof event === 'string' || |
| | |
| | | } |
| | | } |
| | | |
| | | const fn = debounce(confirm, 100) |
| | | |
| | | const fn = debounce(confirm, 200) |
| | | return () => { |
| | | return ( |
| | | <div class={styles.inputContent}> |
| | | <el-input |
| | |
| | | class={styles.searchInner} |
| | | // size="small" |
| | | prefix-icon={<Icon icon="s_input" width={12} height={12} />} |
| | | placeholder={props.placeholder} |
| | | placeholder={_t(props.placeholder)} |
| | | {...attrs} |
| | | onKeydown={fn} |
| | | onChange={fn} |