例如有三個.vue檔案,每個檔案是進行嵌套,而且以彈框形式展示
三個檔案是:index1.vue,index2.vue,index3.vue;
index1.vue內容:
<div>
<Button @click="tankuang2">彈出index2.vue內容</Button>
<Modal
v-model="modalProps2.show"
v-bind="modalProps2"
@on-close="modalProps2.show=false"
@on-confirm="modalProps2={}"
>
<component :is="modalProps2.component" @on-close="modalProps2={}" v-bind="modalProps2" v-on="modalProps2.on">
</component>
</Modal>
</div>
<script>
export default {
methods:{
tankuang2(){
this.modalProps2 = {
show: true,
title:'查看彈框2內容',
width: 460,
component: "compIndex2",
showFooter:false
};
},
}
}
</script>
index2.vue內容:
<div>
<Button @click="tankuang3">彈出index3.vue內容</Button>
<Modal
v-model="modalProps3.show"
v-bind="modalProps3"
@on-close="modalProps3.show=false"
@on-confirm="modalProps3={}"
>
<component :is="modalProps3.component" @on-close="modalProps3={}" v-bind="modalProps3" v-on="modalProps3.on">
</component>
</Modal>
</div>
<script>
export default {
methods:{
tankuang3(){
this.modalProps3 = {
show: true,
title:'查看彈框3內容',
width: 460,
component: "compIndex3",
showFooter:false
};
}
}
}
</script>
這些代碼的意思是嵌套彈框,index2在index1里面以彈框內容展示,index3在index2里面也以彈框內容展示。我現在的困惑是,當按esc按鍵的時候,我不想彈框全部關閉,當打開到最后一層彈框(彈框3)的時候,我想只要當前的最后一層彈框關閉,而不是全部的彈框都關閉。請問有資深人士能不能解惑一下,給個思路也行。這個問題困擾許久了。。。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/104782.html
標籤:JavaScript
上一篇:js跳轉問題
下一篇:后端必須穩打的是什么些技術?
