🐛(input-number): 修复 input-number 类型错误 fixed https://gitee.com/layui/layui-vue/issues/I5CIOC

更新文档
This commit is contained in:
就眠儀式 2022-06-17 18:43:47 +08:00
parent a8b79bf8be
commit 83d4622df9
2 changed files with 6 additions and 6 deletions

View File

@ -16,7 +16,7 @@ export interface LayInputProps {
value?: string;
disabled?: boolean;
readonly?: boolean;
modelValue?: string;
modelValue?: string | number;
placeholder?: string;
allowClear?: boolean;
autofocus?: boolean;
@ -44,7 +44,7 @@ const emit = defineEmits([
const { t } = useI18n();
const slots = useSlots();
const hasContent = computed(() => props.modelValue?.length > 0);
const hasContent = computed(() => (props.modelValue as string)?.length > 0);
const onInput = function (event: Event) {
const inputElement = event.target as HTMLInputElement;

View File

@ -9,7 +9,7 @@ import "./index.less";
import layInput from "../input/index.vue";
import { LayIcon } from "@layui/icons-vue";
import layButton from "../button/index.vue";
import { ref, watch, withDefaults, computed } from "vue";
import { ref, watch, withDefaults, computed, Ref } from "vue";
export interface LayInputNumberProps {
modelValue?: number;
@ -33,7 +33,7 @@ const props = withDefaults(defineProps<LayInputNumberProps>(), {
});
const emit = defineEmits(["update:modelValue", "change"]);
let num = ref(props.modelValue);
let num: Ref<number> = ref(props.modelValue);
watch(num, (val) => {
if (props.max !== Infinity && val > props.max) {
@ -107,7 +107,7 @@ const isNumber = function (num: any) {
<template>
<div class="layui-input-number" :position="position" :size="size">
<lay-button
size="gl"
size="lg"
@mousedown="longDown(subtraction)"
@mouseup="cancelLongDown"
@blur="cancelLongDown"
@ -130,7 +130,7 @@ const isNumber = function (num: any) {
/>
</div>
<lay-button
size="gl"
size="lg"
@mousedown="longDown(addition)"
@mouseup="cancelLongDown"
@blur="cancelLongDown"