<template>
<el-dialog :visible.sync="dialogFormVisible">
<!-- dialog内容 -->
<button @click="dialog">打开富文本编辑器</button>
<tinymce-editor ref="tinyEditor" />
</el-dialog>
</template>
<script>
import { ref, onMounted } from 'vue';
export default {
setup() {
const dialogFormVisible = ref(false);
const tinymceNum = ref(0);
const dialog = () => {
// Dialog显示
dialogFormVisible.value = true;
// 获取tinymce菜单
const selection = document.getElementsByClassName("tox-tinymce-aux");
// 富文本未加载完成
if (selection.length === 0 && tinymceNum.value <= 10) {
tinymceNum.value += 1;
setTimeout(() => {
dialog(); // 重新调用自身
console.log("图层调整失败");
}, 1000);
} else {
tinymceNum.value = 0;
if (selection.length > 0) {
selection[0].style.zIndex = 4000;
console.log("图层调整成功");
}
}
};
return {
dialogFormVisible,
tinymceNum,
dialog,
};
},
};
</script>
<style>
/* 可以在这里添加自定义样式 */
</style>
09-04
2202
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)