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.
37 lines
774 B
37 lines
774 B
<script>
|
|
import PropTypes from '../_util/vue-types'
|
|
import { cloneElement } from '../_util/vnode'
|
|
export default {
|
|
props: {
|
|
value: PropTypes.any,
|
|
disabled: PropTypes.bool,
|
|
},
|
|
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
|
|
const value = $props.value === undefined ? '' : $props.value
|
|
return cloneElement($slots.default[0], {
|
|
domProps: {
|
|
value,
|
|
},
|
|
props: $props,
|
|
on: $listeners,
|
|
attrs: { ...$attrs, value },
|
|
ref: 'ele',
|
|
})
|
|
},
|
|
}
|
|
|
|
</script>
|