gaoluyang
2026-06-24 bfdc0e0e6d5e47aa501f9b6fadd143d9c97cf00a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<script lang="ts" setup>
import { computed } from 'vue';
 
import { Textarea } from 'ant-design-vue';
 
const props = defineProps<{
  modelValue?: null | string;
}>();
 
const emit = defineEmits<{
  (e: 'input', v: null | string): void;
  (e: 'update:modelValue', v: null | string): void;
}>();
 
const content = computed({
  get: () => props.modelValue ?? '',
  set: (val: string) => {
    emit('update:modelValue', val || null);
    emit('input', val || null);
  },
});
</script>
 
<template>
  <Textarea v-model:value="content" :rows="5" placeholder="请输入内容" />
</template>