riku
2025-09-20 0796eebe3520fafb0ac5d36ee584af81506d7e9c
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
<template>
  <el-input v-model="textarea" autosize type="textarea" placeholder="" />
</template>
<script setup>
import { computed, ref } from 'vue';
 
const props = defineProps({
  // 模板
  template: {
    type: String,
    default: ''
  },
  // 参数
  params: {
    type: Object,
    default: () => {}
  }
});
 
const textarea = computed(() => {
  return props.template.replace(/{(\w+)}/g, (match, p1) => {
    return props.params[p1] || '';
  });
});
</script>