修复 src 结构
This commit is contained in:
44
src/component/input/index.vue
Normal file
44
src/component/input/index.vue
Normal file
@@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<input
|
||||
:type="type"
|
||||
:name="name"
|
||||
:value="modelValue"
|
||||
:disabled="disabled"
|
||||
:placeholder="placeholder"
|
||||
:class="{ 'layui-disabled': disabled }"
|
||||
class="layui-input"
|
||||
@input="onInput"
|
||||
@focus="onFocus"
|
||||
@blur="onBlur"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup name="LayInput" lang="ts">
|
||||
import { defineProps, defineEmits } from "vue";
|
||||
|
||||
export interface LayInputProps {
|
||||
name?: string;
|
||||
type?: string;
|
||||
disabled?: boolean;
|
||||
modelValue?: string | number;
|
||||
placeholder?: string;
|
||||
}
|
||||
|
||||
const props = defineProps<LayInputProps>();
|
||||
|
||||
const emit = defineEmits(["update:modelValue", "input", "focus", "blur"]);
|
||||
|
||||
const onInput = function (event: InputEvent) {
|
||||
const inputElement = event.target as HTMLInputElement;
|
||||
emit("update:modelValue", inputElement.value);
|
||||
emit("input", event);
|
||||
};
|
||||
|
||||
const onFocus = function (event: FocusEvent) {
|
||||
emit("focus", event);
|
||||
};
|
||||
|
||||
const onBlur = function () {
|
||||
emit("blur");
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user