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.
53 lines
1000 B
53 lines
1000 B
<script>
|
|
import Input, { InputProps } from './Input'
|
|
import Icon from '../icon'
|
|
|
|
export default {
|
|
name: 'InputSearch',
|
|
props: {
|
|
...InputProps,
|
|
prefixCls: {
|
|
default: 'ant-input-search',
|
|
type: String,
|
|
},
|
|
inputPrefixCls: {
|
|
default: 'ant-input',
|
|
type: String,
|
|
},
|
|
},
|
|
computed: {
|
|
},
|
|
methods: {
|
|
onSearch (e) {
|
|
this.$emit('search', this.$refs.input.stateValue)
|
|
this.$refs.input.focus()
|
|
},
|
|
},
|
|
render () {
|
|
const { inputPrefixCls, prefixCls, ...others } = this.$props
|
|
const inputProps = {
|
|
props: {
|
|
...others,
|
|
prefixCls: inputPrefixCls,
|
|
},
|
|
attrs: this.$attrs,
|
|
}
|
|
return (
|
|
<Input
|
|
{...inputProps}
|
|
onPressEnter={this.onSearch}
|
|
class={prefixCls}
|
|
ref='input'
|
|
>
|
|
<Icon
|
|
slot='suffix'
|
|
class={`${prefixCls}-icon`}
|
|
onClick={this.onSearch}
|
|
type='search'
|
|
/>
|
|
</Input>
|
|
)
|
|
},
|
|
}
|
|
</script>
|