12345678910111213141516171819202122232425262728293031323334353637383940 |
- <template>
- <el-input v-model="proxyValue"
- :placeholder="placeholder"
- :disabled="disabled"
- :style="{width}"
- :maxlength="limit"
- :show-word-limit="showWordLimit && !!limit"
- :clearable="clearable"
- ref="inputRef"></el-input>
- </template>
- <script>
- import { ElInput } from 'element-plus'
- import { useFormInput } from '@cip/components/hooks/form-input'
- import { formInputProps } from '../../form-input-props'
- import { useInputConfig } from './use-input-config'
- export default {
- name: 'BasicInput',
- components: { ElInput },
- props: formInputProps,
- emits: ['update:modelValue'],
- setup (props, context) {
- const formInput = useFormInput(props, context)
- const { width, proxyValue, clearable, inputRef } = formInput
- const { placeholder, limit, showWordLimit } = useInputConfig(formInput)
- context.expose({
- focus: () => { inputRef.value.focus() }
- })
- return {
- inputRef,
- proxyValue,
- placeholder,
- limit,
- showWordLimit,
- width,
- clearable
- }
- }
- }
- </script>
|