mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-16 01:41:15 +08:00
32 lines
644 B
Vue
32 lines
644 B
Vue
|
<script>
|
||
|
import omit from 'omit.js'
|
||
|
import { cloneElement } from '../_util/vnode'
|
||
|
export default {
|
||
|
methods: {
|
||
|
focus () {
|
||
|
const ele = this.$refs.ele
|
||
|
ele.focus ? ele.focus() : this.$el.focus()
|
||
|
},
|
||
|
blur () {
|
||
|
const ele = this.$refs.ele
|
||
|
ele.blur ? ele.blur() : this.$el.blur()
|
||
|
},
|
||
|
|
||
|
},
|
||
|
|
||
|
render () {
|
||
|
const { $slots, $listeners, $props, $attrs } = this
|
||
|
return cloneElement($slots.default, {
|
||
|
domProps: {
|
||
|
value: $props.value,
|
||
|
},
|
||
|
props: omit($props, ['value']),
|
||
|
on: $listeners,
|
||
|
attrs: { ...$attrs, value: $props.value },
|
||
|
ref: 'ele',
|
||
|
})
|
||
|
},
|
||
|
}
|
||
|
|
||
|
</script>
|