🐛(input): typescript 错误

更新文档
This commit is contained in:
就眠儀式 2022-06-11 00:15:54 +08:00
parent bbf39ab795
commit 11bb97ca96

View File

@ -10,21 +10,17 @@ import { LayIcon } from "@layui/icons-vue";
import { computed, useSlots } from "vue"; import { computed, useSlots } from "vue";
import { useI18n } from "../../language"; import { useI18n } from "../../language";
const { t } = useI18n();
const slots = useSlots();
const hasContent = computed(() => props.modelValue?.length > 0);
export interface LayInputProps { export interface LayInputProps {
name?: string; name?: string;
type?: string; type?: string;
value?: string; value?: string;
disabled?: boolean; disabled?: boolean;
readonly?: boolean; readonly?: boolean;
modelValue?: string; modelValue: string;
placeholder?: string; placeholder?: string;
allowClear?: boolean; allowClear?: boolean;
autofocus?: boolean; autofocus?: boolean;
autocomplete?: boolean; autocomplete?: string;
} }
const props = withDefaults(defineProps<LayInputProps>(), { const props = withDefaults(defineProps<LayInputProps>(), {
@ -32,7 +28,6 @@ const props = withDefaults(defineProps<LayInputProps>(), {
readonly: false, readonly: false,
allowClear: false, allowClear: false,
autofocus: false, autofocus: false,
autocomplete: false,
}); });
const emit = defineEmits([ const emit = defineEmits([
@ -44,6 +39,10 @@ const emit = defineEmits([
"blur", "blur",
]); ]);
const { t } = useI18n();
const slots = useSlots();
const hasContent = computed(() => props.modelValue?.length > 0);
const onInput = function (event: Event) { const onInput = function (event: Event) {
const inputElement = event.target as HTMLInputElement; const inputElement = event.target as HTMLInputElement;
const value = inputElement.value; const value = inputElement.value;