子组件中---------------------------------
//暴露内容
const postValue = ref("");
defineExpose({
  postValue, //把子组件的图片暴露出去
});




父组件中-------------------------------
---------------------------------
 <UploadPic ref="postValue" />
// 接收子组件暴露出的图片
const postValue = ref("");




---------------------------------
const addOk = (e) => {
  addVisible.value = false;
  console.log(postValue.value.postValue); //使用父组件暴露的图片
  formState.pic = postValue.value.postValue;
};

Logo

前往低代码交流专区

更多推荐