element中Notification组件(this.$notify)自定义样式

2023-11-06

1、自定义样式效果 

2、vue代码 

this.notifications = this.$notify({
              title: '',
              dangerouslyUseHTMLString: true,
              duration: obj.remindMethod==='3' ? 0:4500,
              customClass: 'notify-warning',
              offset: 50,
              showClose: false,
              message: this.$createElement(
                "div",
                null,
                [
                this.$createElement(
                  "div",
                  {class:'alertTile'}
                ),
                this.$createElement(
                  "div",
                  {class:'alertTile_1'},
                  "报警"
                ),
                this.$createElement(
                  "div",
                  {class:'alertContant'},
                  [
                    this.$createElement(
                      "span",
                      "报警内容" + ":" + obj.data
                    ),
                    this.$createElement(
                      "br",
                      null,
                    ),
                    this.$createElement(
                      "div",
                      {class:'alertContant'},
                      "报警时间:"+obj.time
                    ),
                  ]
                   
                ),
                this.$createElement(
                  "button",
                  {
                    class:'close_notify',
                    on: {
                      click: _this.closeNotify.bind(_this, obj.remindMethod),
                    },
                  },
                  obj.buttonName
                ),
                ]
              ),
            });

 3、CSS、不能用scoped修饰

<style>
  .el-notification__content {
  margin-top:30px
}
.notify-warning {
  background-image: url("../../../assets/images/baojing_box_red.png") !important;
  background-size: 100% 100% !important;
  width: 420px !important;
  height: 120px !important;
  background-position-y: 0px !important;
  background-color: rgba(255, 255, 255, 0) !important;
  margin-top: 50px !important;
  border: none !important;
  box-shadow: 0 2px 12px 0 rgb(0 0 0 / 0) !important;
}
.el-notification__group {
  margin-left: 130px !important;
}
.alertTile_1 {
  position: absolute !important;
  background-image: url("../../../assets/images/alert_red_3.png") !important;
  width: 128px !important;
  height: 128px !important;
  left: 0px !important;
  top: 0px !important;
  border-radius: 64px !important;
  color: white !important;
  line-height: 128px !important;
  text-align: center !important;
  position: relative;
  font-size: 16px !important;
}
.alertTile {
  position: absolute !important;
  background-image: url("../../../assets/images/alert_red_1.png") !important;
  width: 128px !important;
  height: 128px !important;
  left: 0px !important;
  top: 0px !important;
  border-radius: 64px !important;
  color: white !important;
  line-height: 128px !important;
  text-align: center !important;
  position: relative;
  -webkit-transform: rotate(360deg);
  animation: myfirst 3s linear infinite;
  -moz-animation: myfirst 3s linear infinite;
  -webkit-animation: myfirst 3s linear infinite;
  -o-animation: myfirst 3s linear infinite;
  font-size: 16px !important;
}

.alertContant{
  word-wrap:break-word;
  color:white;
}

@-webkit-keyframes myfirst {
  from {
    -webkit-transform: rotate(360deg);
  }

  to {
    -webkit-transform: rotate(0deg);
  }
}
.el-notification__closeBtn{
  top:25px
}

.close_notify{
    color: #fff;
    cursor: pointer;
    width: 50px;
    height: 22px;
    line-height: 20px;
    background: #0f83f7;
    text-align: center;
    position: absolute;
    bottom: 15px;
    right: 5px;
}

</style>

4、自定义关闭按钮

//点击事件回调
    closeNotify(type) {
      console.log("hahah");
      console.log(type);
      if(type === '2'){
      console.log("自动关闭,流程。。");
      }
      if(type === '3'){
      console.log("手动确认,流程。。");
      }
      this.notifications.close();
    },

5、使用到的图片

alert_red_1.png
alert_red_2.png
alert_red_3.png
baojing_box_red.png
baojing_content_red.png

图片地址链接:

https://download.csdn.net/download/askuld/88282624

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

element中Notification组件(this.$notify)自定义样式 的相关文章

随机推荐

  • KNOWLEDGE SOLVER: TEACHING LLMS TO SEARCH FOR DOMAIN KNOWLEDGE FROM KNOWLEDGE GRAPHS

    本文是LLM系列文章 针对 KNOWLEDGE SOLVER TEACHING LLMS TO SEARCH FOR DOMAIN KNOWLEDGE FROM KNOWLEDGE GRAPHS 的翻译 知识求解器 教LLMS从知识图谱中搜
  • 启动Tomcat时,出现Port 8080 required by Tomcat v8.0 Server at localhost is already in use.这样的提示解决方法

    在遇到问题的时候 首先我们应该粗略的阅读一下提示大致是什么意思 提示大概意思就是我们Tomcat服务器需要用的8080端口 现在已经正在被使用 所以当我们要启动Tomcat的时候 我们就需要将此端口进行释放 解决方法 第一步 确定端口号 确
  • 2022年3月20日-2022年3月26日(按照方案B,本周17小时,合计1236小时,剩8764小时。)

    因为编辑器上视频教程快学完了 而好多公司会做编辑器就可以了 可以学完后面面了 所以 这周仍然进行方案A 上周进度ue4视频教程mysql 1 1 tf1 2 1 oss 4 2 simpleThread 1 2 editor1 3 3 继续
  • 一次编辑多平台发布的终极解决方案(基于Markdown)

    导读 利用markdown语法 让更多的博客作者能够专注于写作本身 而不会因为各种设置打乱了创作的思绪 本文首先简单介绍markdown的编辑器Typora 接着描述了怎么通过Typora的代码模式将编辑好的文件发布到csdn和微信公众号
  • ajax传回的数据不显示,ajax请求返回的数据显示不出来?求教

    出现问题 PHP代码
  • 分布式事务与锁

    事务基础概念 事物的回顾 事务的定义 是数据库的操作的最小工作单元 是作为单个逻辑工作单元执行的一系列操作 这些操作作为一个整体一起向系统提交 要么都执行 要么都不执行 事务是一组不可在分割的操作集合 事务的ACID原则 事务具有四个基本特
  • 从程序员到项目经理:项目管理三大目标

    项目管理的三大目标即时间 成本和质量 实际是告诉项目经理应重点关注什么因素 项目控制应该做什么工作 三大目标虽然简单 但如果能将其真正贯彻 到自己的行动中 那么对项目计划制定 过程控制等工作 均能起到引导作用 有了努力的方向 项目经理也就可
  • Kali2022安装Nessus——Docker版

    下载镜像并且创建Nessus容器 root kali docker run itd name ramisec nessus p 8834 8834 ramisec nessus 更新nessus插件 root kali docker exe
  • Coding-数组(Array)

    数组 Array 面试中最常见的就是围绕数组进行出题 主要原则数组可以随机读取 一般遇到数组相关的题目 都不是直观看到的那样 第一步暴力解法 第二步是否可以排序 是否可以二分 是否可以使用数据结构 哈希表 队列 栈等 要时刻注意一个数组中有
  • 经典神经网络( AlexNet,VggNet,NiN,GoogLeNet,ResNet)

    卷积神经网络演化史 AlexNet 模型结构 贡献 ReLU激活函数 分布式GPU运算 LRN 局部响应归一化 提高泛化能力 重叠池化 池化窗的步长小于池化层的大小 在池 化时产生重叠 正则化方法 数据集增强 dropout 随机关闭神经元
  • Powershell:如何创建自定义对象,以及如何给自定义对象添加属性和方法

    还记得我刚学会使用PowerShell的时候 那种兴奋和幸福感 终于找到了在Windows下一个强大的Shell 因为他叫Power Shell 可以一边使用着熟悉的Windows桌面系统一边装X的Shell编程了 当我使用它来处理CSV时
  • Qt中的UI文件介绍

    UI文件是什么 u i ui ui通常是指Qt设计师设计出来的界面文件的后缀 它本质上是一个标准XML格式的文本文件 需要通过 u i
  • 前端moment库时间戳转标准时间不准确的问题解决

    做前端项目的时候 根据后台返回的一个时间戳 将时间戳需要转换成标准时间 因为项目中有moment这个时间处理包 而且moment对于时间的转换比较强大 可以根据特定的格式进行转换 最终将时间戳转换成 年 月 日 时 分 秒 这种形式 但是转
  • SpringQueryMap -SpringCloud feign get method 接受自定义对象参数

    feign中和controller中不一样的地方 controller中可以get方法使用对象参数无需任何注解 可默认绑定到对象 示例代码如下 GetMapping value ClueClient LIST OPERATIONS publ
  • J2EE基础集合框架之Set

    前言 上次与大家介绍了集合框架的LIst集合 List集合的特点的是元素有序且可重复 今天与大家分享的是也是一种集合 叫做Set集合 他和List集合是相反的 今天我们就一起去探究Set集合 首先跟思维导图来了解我今天要分享的内容吧 说明
  • 卷积神经网络&目标检测

    卷积神经网络 目标检测 一 Inception网络 1 Inception网络基本思想 2 采用1 1卷积降低计算量 3 Inception模块和Inception网络 二 迁移学习 三 数据扩充方法 四 目标检测 1 特征点检测 2 通过
  • postman的json脚本转jmeter的jmx脚本

    一般研发同学会用postman做接口自测 但是我们做性能测试的时候 又不能用postman 对鉴权不了解的接口 自己调试脚本又很麻烦 这个时候 我们就可以用这个方法把json脚本转换成jmeter用的jmx脚本 环境准备 这几个工具需要提前
  • join python

    Python join 方法用于将序列中的元素以指定的字符连接生成一个新的字符串 1 join是针对字符串进行操作的 2 join里面的参数只能是一个 可以是字典 列表 元组 然后以前面的分隔 形成一个新的字符串 但是里面的东西必须是字符串
  • 百度智能云x蓝色光标共绘AI营销新篇章

    9月12日 百度集团副总裁袁佛玉参加蓝色光标Blue AI行业模型发布会 参与启动仪式并带来了主题演讲 大模型重塑数智世界 此次蓝色光标推出的行业模型 得益于百度智能云千帆大模型平台 以下简称千帆平台 的强大支持 标志着双方合作的深度与广度
  • element中Notification组件(this.$notify)自定义样式

    1 自定义样式效果 2 vue代码 this notifications this notify title dangerouslyUseHTMLString true duration obj remindMethod 3 0 4500