修复 src 结构
This commit is contained in:
9
src/component/textarea/index.ts
Normal file
9
src/component/textarea/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { App } from "vue";
|
||||
import Component from "./index.vue";
|
||||
import type { IDefineComponent } from "../type/index";
|
||||
|
||||
Component.install = (app: App) => {
|
||||
app.component(Component.name || "LayTextarea", Component);
|
||||
};
|
||||
|
||||
export default Component as IDefineComponent;
|
||||
48
src/component/textarea/index.vue
Normal file
48
src/component/textarea/index.vue
Normal file
@@ -0,0 +1,48 @@
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: "LayTextarea",
|
||||
};
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineProps, defineEmits } from "vue";
|
||||
|
||||
export interface LayTextareaProps {
|
||||
name?: string;
|
||||
modelValue?: string;
|
||||
placeholder?: string;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
const props = defineProps<LayTextareaProps>();
|
||||
|
||||
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", inputElement.value);
|
||||
};
|
||||
|
||||
const onFocus = function (event: FocusEvent) {
|
||||
emit("focus", event);
|
||||
};
|
||||
|
||||
const onBlur = function () {
|
||||
emit("blur");
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<textarea
|
||||
:value="modelValue"
|
||||
:placeholder="placeholder"
|
||||
:name="name"
|
||||
:disabled="disabled"
|
||||
class="layui-textarea"
|
||||
:class="{ 'layui-disabled': disabled }"
|
||||
@input="onInput"
|
||||
@focus="onFocus"
|
||||
@blur="onBlur"
|
||||
></textarea>
|
||||
</template>
|
||||
Reference in New Issue
Block a user