父组件
const content = ref("");
ElMessageBox({
title: `${title}商机跟进`,
message: h(ProgressDetailForm, {
content: content.value,
//这里事件定义 一定要加on+UpdateVal的形式 否则无法自定义事件无法生效
onUpdateVal: (val: string) => {
content.value = val;
}
})
}).then(() => {
});
子组件
<script setup lang="ts">
import { number } from "echarts";
import { ref } from "vue";
const props = defineProps({
content: String
});
const contentText = ref(props.content);
const emit = defineEmits(["updateVal"]);
const updateVal = (val: string) => {
contentText.value = val;
emit("updateVal", val);
};
</script>
<template>
<div>
<el-input
type="textarea"
rows="5"
placeholder="请输入商机跟进内容"
:modelValue="contentText"
@input="updateVal"
/>
</div>
</template>