最近开发中遇到的一个问题:
我的消息提示,被弹框遮住了:
问题原因是:element UI
默认给$message
消息弹框动态添加的z-index
值比对话框小
解决办法:
网上说,给消息弹框配置自定义class,于是我就配置了:
this.$message({type:'warning',message:"必须选则一个模板且仅能选择一个!",customClass:"messageClass"});
<style >
/* 必须是全局style,不能有scoped */
.messageClass{
z-index: 3000 !important;
}
</style>
但是使用的时候却报错:TypeError: _this3.$message is not a function
于是我又换了一种写法,完美解决!
在需要的页面引入
import { Message } from "element-ui";
使用:
Message.warning("必须选则一个模板且仅能选择一个!");
// 或者
Message({
type: "warning",
message: "必须选则一个模板且仅能选择一个!"
});
不用自定义class,就可以了!