refactor(Scene): 修复弹窗层级问题

- 移除创建组件的固定定位样式
- 使用 includes 替代多个 || 判断
- 注释掉 z-index操作代码块
This commit is contained in:
du.meimei
2025-05-20 18:55:22 +08:00
parent c8a83c3e00
commit 71922243f1

View File

@@ -37,8 +37,9 @@
</div>
</div>
<create ref="createRef"
style="width: 1px;height: 0;position: fixed"
@update:ai-assistant-visible="getValue"></create>
style="width: 1px;height: 0"
@update:ai-assistant-visible="getValue">
</create>
<!-- 概念测试 -->
<ConceptTest ref="conceptTestRef" />
@@ -104,7 +105,7 @@ const getSceneList=()=>{
* @param index
*/
const createScene = (scene,index)=>{
if (index === 0 || index === 1 || index === 2){
if ([0, 1, 2].includes(index)){
if (createRef.value) {
// 检查 scene 是否有 value 属性,如果没有则直接使用 scene
const sceneData = scene.value !== undefined ? scene.value : scene;
@@ -132,11 +133,11 @@ const getValue = (val) => {
const indicators = Array.from(document.getElementsByClassName('el-carousel__indicators'))
const allElements = [...containers, ...indicators]
allElements.forEach(item => {
if (item) {
item.style.zIndex = val ? '-1' : 'unset'
}
})
// allElements.forEach(item => {
// if (item) {
// item.style.zIndex = val ? '-1' : 'unset'
// }
// })
}
// 使用 defineExpose 显式暴露方法,使其可以被外部组件通过 ref 访问