按照 https://element-plus.gitee.io... 说的,我使用了 "openDialog" 函数获取 "refCompContent",代码类似:
<template>
<el-dialog ref="refDialog" @open="openDialog">
<component :is="compContent" ref="refCompContent"/>
</el-dialog>
</template>
<script>
const refCompContent = ref(null)
const openDialog = () => {
console.log('>>> refCompContent::', refCompContent)
}
</script>
但 "refCompContent" 是 null,怎么才能正确的获取到 "refCompContent"?谢谢
const refDialog = ref(null)
// ref 引用名称 跟template里面要保持一致