|
|
@ -3,6 +3,7 @@ import { computed, defineComponent, shallowRef, ref, watch } from 'vue'; |
|
|
|
import PropTypes from './vue-types'; |
|
|
|
import PropTypes from './vue-types'; |
|
|
|
import type { BaseInputInnerExpose } from './BaseInputInner'; |
|
|
|
import type { BaseInputInnerExpose } from './BaseInputInner'; |
|
|
|
import BaseInputInner from './BaseInputInner'; |
|
|
|
import BaseInputInner from './BaseInputInner'; |
|
|
|
|
|
|
|
import { styleObjectToString } from '../vc-util/Dom/css'; |
|
|
|
|
|
|
|
|
|
|
|
export interface BaseInputExpose { |
|
|
|
export interface BaseInputExpose { |
|
|
|
focus: () => void; |
|
|
|
focus: () => void; |
|
|
@ -32,7 +33,7 @@ const BaseInput = defineComponent({ |
|
|
|
default: 'input', |
|
|
|
default: 'input', |
|
|
|
}, |
|
|
|
}, |
|
|
|
size: PropTypes.string, |
|
|
|
size: PropTypes.string, |
|
|
|
style: PropTypes.style, |
|
|
|
style: PropTypes.oneOfType([String, Object]), |
|
|
|
class: PropTypes.string, |
|
|
|
class: PropTypes.string, |
|
|
|
}, |
|
|
|
}, |
|
|
|
emits: [ |
|
|
|
emits: [ |
|
|
@ -134,13 +135,18 @@ const BaseInput = defineComponent({ |
|
|
|
const handlePaste = (e: ClipboardEvent) => { |
|
|
|
const handlePaste = (e: ClipboardEvent) => { |
|
|
|
emit('paste', e); |
|
|
|
emit('paste', e); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
const styleString = computed(() => { |
|
|
|
|
|
|
|
return props.style && typeof props.style !== 'string' |
|
|
|
|
|
|
|
? styleObjectToString(props.style) |
|
|
|
|
|
|
|
: props.style; |
|
|
|
|
|
|
|
}); |
|
|
|
return () => { |
|
|
|
return () => { |
|
|
|
const { tag: Tag, style, ...restProps } = props; |
|
|
|
const { style, lazy, ...restProps } = props; |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<BaseInputInner |
|
|
|
<BaseInputInner |
|
|
|
{...restProps} |
|
|
|
{...restProps} |
|
|
|
{...attrs} |
|
|
|
{...attrs} |
|
|
|
style={JSON.stringify(style)} |
|
|
|
style={styleString.value} |
|
|
|
onInput={handleInput} |
|
|
|
onInput={handleInput} |
|
|
|
onChange={handleChange} |
|
|
|
onChange={handleChange} |
|
|
|
onBlur={handleBlur} |
|
|
|
onBlur={handleBlur} |
|
|
|