1、解决部署到服务器后Element UI图标不显示问题(404错误);打开 build/utils.js 文件,在如下位置添加 publicPath: '…/…/'
2、弹窗关闭报错误 数据传递的错误
:before-close=“close"
3、导航菜单,连续点击同一个导航时,报错
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
// router文件夹-->index.js文件
//cv以下代码解决路由地址重复的报错问题(一劳永逸)
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
4、使用element-ui的弹出框(dialog),页面会抖动一下
会发现页面的右边多了5px,看起来像是抖了一下,仔细发现是body多了样式,padding-right:5px 和 overflow: hidden;
解决方法:全局设置 body{padding-right:0 !important}
5、Element UI 弹窗(Dialog)改成自适应高度,仅body内容部分滚动,外部不滚动;
.demo-dialog {
display: flex;
justify-content: center;
align-items: Center;
overflow: hidden;
.el-dialog {
.el-dialog__body {
padding: 0 15px;
z-index: 1;
overflow: hidden;
overflow-y: auto;
}
}
}
在el-dialog标签中设置class=“demo-dialog”即可,弹窗为页面高度的90%,且上下居中。el-dialog__body内容部分会根据内容的高度,自动显示上下的滚动条。