🐛(input-number): 修复 input-number 类型错误 fixed https://gitee.com/layui/layui-vue/issues/I5CIOC
更新文档
This commit is contained in:
parent
a8b79bf8be
commit
83d4622df9
@ -16,7 +16,7 @@ export interface LayInputProps {
|
|||||||
value?: string;
|
value?: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
modelValue?: string;
|
modelValue?: string | number;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
allowClear?: boolean;
|
allowClear?: boolean;
|
||||||
autofocus?: boolean;
|
autofocus?: boolean;
|
||||||
@ -44,7 +44,7 @@ const emit = defineEmits([
|
|||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const slots = useSlots();
|
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 onInput = function (event: Event) {
|
||||||
const inputElement = event.target as HTMLInputElement;
|
const inputElement = event.target as HTMLInputElement;
|
||||||
|
@ -9,7 +9,7 @@ import "./index.less";
|
|||||||
import layInput from "../input/index.vue";
|
import layInput from "../input/index.vue";
|
||||||
import { LayIcon } from "@layui/icons-vue";
|
import { LayIcon } from "@layui/icons-vue";
|
||||||
import layButton from "../button/index.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 {
|
export interface LayInputNumberProps {
|
||||||
modelValue?: number;
|
modelValue?: number;
|
||||||
@ -33,7 +33,7 @@ const props = withDefaults(defineProps<LayInputNumberProps>(), {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(["update:modelValue", "change"]);
|
const emit = defineEmits(["update:modelValue", "change"]);
|
||||||
let num = ref(props.modelValue);
|
let num: Ref<number> = ref(props.modelValue);
|
||||||
|
|
||||||
watch(num, (val) => {
|
watch(num, (val) => {
|
||||||
if (props.max !== Infinity && val > props.max) {
|
if (props.max !== Infinity && val > props.max) {
|
||||||
@ -107,7 +107,7 @@ const isNumber = function (num: any) {
|
|||||||
<template>
|
<template>
|
||||||
<div class="layui-input-number" :position="position" :size="size">
|
<div class="layui-input-number" :position="position" :size="size">
|
||||||
<lay-button
|
<lay-button
|
||||||
size="gl"
|
size="lg"
|
||||||
@mousedown="longDown(subtraction)"
|
@mousedown="longDown(subtraction)"
|
||||||
@mouseup="cancelLongDown"
|
@mouseup="cancelLongDown"
|
||||||
@blur="cancelLongDown"
|
@blur="cancelLongDown"
|
||||||
@ -130,7 +130,7 @@ const isNumber = function (num: any) {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<lay-button
|
<lay-button
|
||||||
size="gl"
|
size="lg"
|
||||||
@mousedown="longDown(addition)"
|
@mousedown="longDown(addition)"
|
||||||
@mouseup="cancelLongDown"
|
@mouseup="cancelLongDown"
|
||||||
@blur="cancelLongDown"
|
@blur="cancelLongDown"
|
||||||
|
Loading…
Reference in New Issue
Block a user