(input): 新增 max 与 min 属性, 用于控制 type=number 下的最大值与最小值

This commit is contained in:
就眠儀式 2022-11-04 01:08:58 +08:00
parent 9bbb99bc74
commit bbf0409262
2 changed files with 8 additions and 2 deletions

View File

@ -27,6 +27,8 @@ export interface InputProps {
password?: boolean;
size?: InputSize;
maxlength?: number;
max?: number;
min?: number;
}
const props = withDefaults(defineProps<InputProps>(), {
@ -159,6 +161,8 @@ const showPassword = () => {
:autofocus="autofocus"
:autocomplete="autocomplete"
:maxlength="maxlength"
:max="max"
:min="min"
:readonly="readonly"
@input="onInput"
@change="onChange"

View File

@ -135,11 +135,13 @@ const isNumber = function (num: any) {
<div class="layui-input-number-input">
<lay-input
v-model="num"
:readonly="disabledInput || disabled"
type="number"
:readonly="disabledInput || disabled"
:disabled="disabledInput || disabled"
:max="max"
:min="min"
:name="name"
@change="inputChange"
:disabled="disabledInput || disabled"
/>
</div>
<lay-button