el-popup-parent--hidden 弹框bug问题

本文介绍了如何通过CSS解决弹窗显示时body的padding-right问题,确保弹窗打开时向右偏移5px,关闭时回归原位。关键在于为body添加padding-right: 0px !important; overflow: hidden !important;样式,并注意el-popup-parent--hidden类的设置。此解决方案适用于全局样式或app.vue页面中。

问题:点击弹框body添加个class:el-popup-parent--hidden并赋予样式padding-right: 5px;

结果:打开弹狂 盒子向右自动5px,关闭弹窗 盒子向左回归原来位置;

解决:在app.vue页面 或者全局的样式里面 给body样式添加

padding-right: 0px !important;

overflow: hidden !important;

注:给el-popup-parent--hidden设置padding-right: 0px !important;overflow: hidden !important 无效 必须要给body设置样式

使用vue3+vite+ts+element若依的项目功能,写一个界面,比如我一个table,有两条数据,id是:innerNo:A1和A2,对他们都点击修改,根据路由配置,应该生成两个修改的界面和原本的index.vue界面,A1的修改界面和index和A2的修改界面与index要能相互切换,两个修改界面也要能相互切换,把相关代码和路由等配置都生成一下,使用代码块生成 需要适配我的appMain.vue代码: <template> <section class="app-main"> <router-view v-slot="{ Component, route }"> <transition v-if="!route.meta.noCache" :enter-active-class="animate" mode="out-in"> <keep-alive v-if="!route.meta.noCache" :include="tagsViewStore.cachedViews"> <component :is="Component" v-if="!route.meta.link" :key="route.fullPath" /> </keep-alive> </transition> <transition v-if="route.meta.noCache" :enter-active-class="animate" mode="out-in"> <component :is="Component" v-if="!route.meta.link && route.meta.noCache" :key="route.fullPath" /> </transition> </router-view> <iframe-toggle /> </section> </template> <script setup name="AppMain" lang="ts"> import { useSettingsStore } from '@/store/modules/settings'; import { useTagsViewStore } from '@/store/modules/tagsView'; import IframeToggle from './IframeToggle/index.vue'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; const route = useRoute(); const tagsViewStore = useTagsViewStore(); // 随机动画集合 const animate = ref<string>(''); const animationEnable = ref(useSettingsStore().animationEnable); watch( () => useSettingsStore().animationEnable, (val: boolean) => { animationEnable.value = val; if (val) { animate.value = proxy?.animate.animateList[Math.round(Math.random() * proxy?.animate.animateList.length)] as string; } else { animate.value = proxy?.animate.defaultAnimate as string; } }, { immediate: true } ); watch( () => route.fullPath, (val: any) => { console.log('route.fullPath:'+route.fullPath); }, { immediate: true } ); watch( () => route.path, (val: any) => { console.log('route.path:'+route.path); }, { immediate: true } ); onMounted(() => { addIframe() }) watchEffect((route) => { addIframe() }) function addIframe() { if (route.meta.link) { useTagsViewStore().addIframeView(route) } } </script> <style lang="scss" scoped> .app-main { /* 50= navbar 50 */ min-height: calc(100vh - 50px); width: 100%; position: relative; overflow: hidden; } .fixed-header + .app-main { padding-top: 50px; } .hasTagsView { .app-main { /* 84 = navbar + tags-view = 50 + 34 */ min-height: calc(100vh - 84px); } .fixed-header + .app-main { padding-top: 84px; } } </style> <style lang="scss"> // fix css style bug in open el-dialog .el-popup-parent--hidden { .fixed-header { padding-right: 6px; } } ::-webkit-scrollbar { width: 6px; height: 6px; } ::-webkit-scrollbar-track { background-color: #f1f1f1; } ::-webkit-scrollbar-thumb { background-color: #c0c0c0; border-radius: 3px; } </style>
11-26
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值