[Feature Request] Provide a switch to let each dialog has its own v-modal
Existing Component
Yes
Component Name
el-dialog/v-modal/messageBox
Description
I use element-ui in my project. It's a nice Toolkit. But recently I have a new request. the reproduction lick: https://jsfiddle.net/pj71jkyw/717/.
The request is: each page has its own dialogs, and the tabs must to be able to switch when a dialog is shown, and the dialog should be keep shown if I open it and switch to other tab.
At first I try to use CSS to complete the aim:
.v-modal,.el-dialog__wrapper{
position:absolute !important;
}
.inner-box{
position:relative
}
It seems good so far. Now is the problem, just follow the steps:
- click the button of tab1, and the dialog1 of tab1 is shown;
- click the title of tab2, switch to the tab2;
- click the button of tab2, and the dialog2 of tab2 is shown;
- switch back to the tab1
now we can find that the mask layer (v-modal element) of dialog1 is disappear, and dialog2 has double layers of v-modal;
I read the code of Popup.vue, recognized that it seemed you use a list called modalStack to save the v-modal layers, and all the v-modal share the some list? That cases the problem.
Hope you can provide a switch to let each dialog has its own v-modal. Or can you give me some advice? Thank you!
英文不好,不知道有没有说明白。。
Translation of this issue:
Existing Component
Yes
Component Name
El-dialog/v-modal/messageBox
Description
I use element-ui in my project. It's a https://jsfiddle.net/pj71jkyw/707/. nice Toolkit. But recently I have a new request. the reproduction lick:
The request is: each page has its own dialogs, and the tabs must to be able to switch when a dialog is shown, and the dialog should be keep shown if I tab. open it and switch to other At first I try to use CSS to complete the aim:
. .v-modal,.El-dialog__wrapper{
Position:absolute! Important; }
.inner-box{ Position:relative
} .
It seems good so far. Now is the problem, just follow the steps:
-
click the button of tab1, and the dialog1 of tab1 is shown;
-
click the title of TAB2, switch to the tab2;
-
click the button of TAB2, and the dialog2 of TAB2 is shown;
-
switch back to the tab1 Now we can find that the mask layer (v-modal element) of dialog1 is disappear, and dialog2 has double layers of v-modal;
I read the code of Popup.vue, recognized that it seemed you use a list called modalStack to save the v-modal layers, and all the v-modal share the some list? That cases the problem.
Hope you can provide a switch to let each dialog has its own v-modal. Or can you give me some advice? Thank you!
English is not good, I don't know if I can understand it..
Having only one backdrop for all popup components is a fundamental design of Element. It keeps DOM clean and makes z-index easier to manage. So we'll probably keep it as is.
As for your case, I came up with a workaround: https://jsfiddle.net/pj71jkyw/719/ .
Thank you for your reply !
the example above is too simple, so you can use one more property to save the state.
But in my actual project, there are more than 20 tabs(actually, each tabs is a separate page, with their own route), and each tabs has more than 1 dialog and messageBox. So the solution will be complicated.
What's more, it is not useful in the <MessageBox> component, because MessageBox do not has a option like visible.sync in dialog to control its display.
Anyway, thank you for your help. Your answer gave me some inspiration. I will think about some compromise.
I have the some problem. Is there anyway to solve this problem!