[新增] textarea 组件
This commit is contained in:
9
src/module/textarea/index.ts
Normal file
9
src/module/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
|
||||
21
src/module/textarea/index.vue
Normal file
21
src/module/textarea/index.vue
Normal file
@@ -0,0 +1,21 @@
|
||||
<template>
|
||||
<textarea :value="modelValue" :placeholder="placeholder" :name="name" class="layui-textarea" @input="updateValue"></textarea>
|
||||
</template>
|
||||
|
||||
<script setup name="LayTextarea" lang="ts">
|
||||
import { defineProps, defineEmits } from '@vue/runtime-core'
|
||||
|
||||
const props =
|
||||
defineProps<{
|
||||
name?: string
|
||||
modelValue?: string
|
||||
placeholder?: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
const updateValue = function(event: InputEvent) {
|
||||
emit('update:modelValue', (event.target as HTMLInputElement).value)
|
||||
}
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user