Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k views
in Technique[技术] by (71.8m points)

关于 keep-alive 的路由跳转后存在 遮罩层的问题

我有 A,B 两个缓存组件

<keep-alive>
    <router-view/>
<keep-alive>

A 页面有一个 el-modal框(遮罩层必须保留),modal 框中有个按钮 button 跳转到 B
此时 B 也同时出现的遮罩层...
目前实现的方案是
记录下 A 遮罩层的状态,然后点击 button 关闭遮罩层 跳转 B
然后跳转回A 的时候 每次就重新判断状态 打开还是关闭.

这个方案感觉不是很通用,每个页面都需要加入对应的逻辑
请教大佬 有没有通用的解决方案~~~


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

el-modal是什么鬼?你是想说el-dialog吗?

el-dialog有个属性modal-append-to-body,添加这个属性,值设为false再试试。
https://element.eleme.cn/#/zh...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...