feat: VnInput numberValidation
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
d15a92ce7d
commit
0f5d06614d
|
@ -52,6 +52,12 @@ const focus = () => {
|
|||
defineExpose({
|
||||
focus,
|
||||
});
|
||||
|
||||
const inputRules = (val) => {
|
||||
const { min } = vnInputRef.value.$attrs;
|
||||
if (min >= 0)
|
||||
if (val.toString().indexOf('.') < min) return t('inputMin', { value: min });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -68,6 +74,8 @@ defineExpose({
|
|||
:class="{ required: $attrs.required }"
|
||||
@keyup.enter="onEnterPress()"
|
||||
:clearable="false"
|
||||
:rules="[inputRules]"
|
||||
:lazy-rules="true"
|
||||
>
|
||||
<template v-if="$slots.prepend" #prepend>
|
||||
<slot name="prepend" />
|
||||
|
@ -85,3 +93,9 @@ defineExpose({
|
|||
</QInput>
|
||||
</div>
|
||||
</template>
|
||||
<i18n>
|
||||
en:
|
||||
inputMin: Must be more than {value}
|
||||
es:
|
||||
inputMin: Debe ser mayor a {value}
|
||||
</i18n>
|
||||
|
|
Loading…
Reference in New Issue