[修复] input组件中的readonly属性不生效问题

This commit is contained in:
castleiMac 2022-04-03 20:17:16 +08:00
parent 262fb12e28
commit d54cf9933f

View File

@ -8,19 +8,19 @@ export default {
import "./index.less"; import "./index.less";
import { useSlots } from "vue"; import { useSlots } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { Boolean, String } from "src/types";
const { t } = useI18n(); const { t } = useI18n();
const slots = useSlots(); const slots = useSlots();
export interface LayInputProps { export interface LayInputProps {
name?: String; name?: string;
type?: String; type?: string;
value?: String; value?: string;
disabled?: Boolean; disabled?: boolean;
modelValue?: String; readonly?: boolean;
placeholder?: String; modelValue?: string;
allowClear?: Boolean; placeholder?: string;
allowClear?: boolean;
} }
const props = withDefaults(defineProps<LayInputProps>(), {}); const props = withDefaults(defineProps<LayInputProps>(), {});
@ -73,6 +73,7 @@ const onBlur = () => {
@focus="onFocus" @focus="onFocus"
@blur="onBlur" @blur="onBlur"
@change="onChange" @change="onChange"
:readonly="props.readonly"
/> />
<span class="layui-input-suffix" v-if="slots.suffix"> <span class="layui-input-suffix" v-if="slots.suffix">
<slot name="suffix"></slot> <slot name="suffix"></slot>