(component): 新增 input 组件 maxlength 属性, 原生属性限制输入长度

This commit is contained in:
就眠儀式 2022-07-28 10:30:55 +08:00
parent 1a7aacbcb8
commit a7e0086e52

View File

@ -24,6 +24,7 @@ export interface LayInputProps {
readonly?: boolean;
password?: boolean;
size?: "lg" | "md" | "sm" | "xs";
maxlength?: number;
}
const props = withDefaults(defineProps<LayInputProps>(), {
@ -138,12 +139,13 @@ const showPassword = () => {
:placeholder="placeholder"
:autofocus="autofocus"
:autocomplete="autocomplete"
:maxlength="maxlength"
:readonly="readonly"
:class="classes"
@input="onInput"
@change="onChange"
@focus="onFocus"
@blur="onBlur"
@change="onChange"
/>
<span class="layui-input-suffix" v-if="slots.suffix || props.suffixIcon">
<slot name="suffix" v-if="slots.suffix"></slot>