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/Search.jsx

54 lines
1005 B

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