vue2 消息弹框

父页面

<template>
  <div style="margin-top: 20px">
    <div class="nav-style msg-style">
      <el-badge :value="value" :max="99" class="num" v-if="value > 0">
        <i class="el-icon-bell"></i>
      </el-badge>
      <i class="el-icon-bell" v-else></i>
      <message class="news-style" @getNums="getNumsFn"></message>
    </div>
  </div>
</template>
<script>
import message from './message.vue'
export default {
  components: { message },
  data() {
    return {
      value: 0
    }
  },

  methods: {
    getNumsFn(val) {
      this.value = val
    }
  }
}
</script>

<style scoped>
.el-icon-bell {
  font-size: 16px;
}

.nav-style label {
  text-align: center;
  width: 16px;
  height: 16px;
  position: absolute;
  top: 3px;
  right: 16px;
}

.nav-style .name {
  height: 22px;
  margin-top: 19px;
  margin-bottom: 19px;
  font-size: 14px;
  font-weight: 400;
  color: #24324c;
  line-height: 22px;
}

.msg-style {
  position: relative;
  float: right;
  margin-right: 100px;
}
.msg-style:hover .news-style {
  display: block;
}
.msg-style .num {
  line-height: 100%;
}
::v-deep .msg-style .el-badge__content {
  margin-top: 3px;
  padding: 0 3px;
  /* width: 28px; */
  min-width: 16px;
  height: 16px;
  background: #f2314e;
  text-align: center;
  line-height: 16px;
  font-size: 12px;
  z-index: 3;
}

.nav-style .el-button {
  font-size: 14px;
}
</style>

子页面(message.vue)

<template>
  <div class="news-style">
    <div class="msg">
      <div class="msg-header">消息中心</div>
      <div class="msg-style">
        <div v-if="msglist.length > 0">
          <div class="item" v-for="item in msglist" :key="item.id">
            <span class="blue dot"></span>
            <a
              :href="item.url"
              target="_blank"
              :class="[item.url ? 'title-style' : '', 'title']"
              v-bind:title="msglist.title"
            >
              <span @click="titleFn(item.id)" v-html="item.title"></span>
            </a>
          </div>
        </div>
        <div class="no-item" v-else>
          <span>暂无新消息,去别的地方看看吧~</span>
        </div>
      </div>
      <div class="msg-footer">
        <el-button type="text" @click="markFn" :disabled="msglist.length === 0"> 全部标为已读 </el-button>
        <!-- 跳转 -->
        <a class="link" target="_blank" rel="noreferrer" href="#/">查看全部 <i class="el-icon-arrow-right"></i> </a>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      msglist: [],
      isRead: false
    }
  },
  created() {
    this.informationFn() //信息
  },

  methods: {
    informationFn() {
      // 页面只能先展示2条
      const falselist = {
        num: 2,
        data: [
          {
            title: '宫1',
            id: 'c',
            url: 'https://fanyi.baidu.com/translate#en'
          },
          {
            title: '宫2',
            id: '0',
            url: 'https://www.baidu.com/'
          }
        ]
      }
      this.msglist = falselist.data ? falselist.data : []
      this.$emit('getNums', falselist.num)
    },

    markFn() {
      const ids = this.msglist.map(item => item.id)
      // 调接口
    },
    titleFn(id) {
      // 调接口
    }
  },
  beforeDestroy() {}
}
</script>

<style lang="scss" scoped>
.news-style {
  position: absolute;
  // top: 40px;//这个是为了固定的
  right: -10px;
  display: none;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0px 8px 12px 4px rgba(0, 16, 47, 0.05);
  transition: all 0.3s;
}
.news-style .msg {
  position: relative;
  padding: 20px 0px 28px 28px;
  width: 356px;
  height: 313px;
  height: 230px;
}
.msg-header {
  margin-bottom: 25px;
  font-family: PingFangSC-Regular;
  font-size: 16px;
  font-weight: normal;
  line-height: 24px;
  color: #24324c;
}
.msg-style {
  overflow-y: scroll;
  margin-bottom: 64px;
  padding-right: 28px;
  .item {
    display: flex;
    justify-content: start;
    align-items: center;
    height: 40px;
    line-height: 40px;
    border-bottom: 1px solid rgba(#00102f, $alpha: 5%);
    .dot {
      display: inline-block;
      margin-right: 6px;
      min-width: 8px;
      height: 8px;
      border-radius: 50%;
    }
    .title {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-family: PingFangSC-Regular;
      color: #24324c;
    }
    .title-style:hover {
      color: #2662ff;
    }
  }
  .item:last-child {
    border: 0;
  }
}
.msg-style .no-item {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  cursor: default;
  color: #8c93a1;
  img {
    margin: 10px 0 5px 0;
  }
}
.msg-style .item .red {
  background: #ff5959;
}
.msg-style .item .org {
  background: #ff8800;
}
.msg-style .item .blue {
  background: #5987ff;
}
.msg-footer {
  position: absolute;
  bottom: 0;
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  width: 300px;
  line-height: 22px;
  img {
    vertical-align: bottom;
  }
  .link {
    margin-top: 9px;
    color: #2662ff;
  }
  ::v-deep .el-button {
    font-family: PingFangSC-Regular;
    font-size: 14px;
    font-weight: normal;
    color: rgba(0, 16, 47, 0.65);
  }
  ::v-deep .el-button--text.is-disabled {
    color: #bfc3cb;
  }
}
</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/293765.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

关于开关量信号隔离器在水泥厂的应用探讨-安科瑞 蒋静

摘要&#xff1a;在水泥厂生产过程中&#xff0c;需要皮带与提升机进行运输物料&#xff0c;回转下料器进行投放物料。其中涉及大量电动机相关的机械运动&#xff0c;对这些机械运动状态进行检测&#xff0c;可以及时发现问题避免造成事故。针对机械位置检测&#xff0c;通常使…

Redis第四讲——Redis的数据库结构、删除策略及淘汰策略

一、redis中的数据库 redis服务器将所有数据库都保存在服务器状态redis.h/redisServer结构的db数组中。db数组的每项都是一个redis.h/redisDb结构&#xff0c;而每个redisDb结构就代表一个数据库。在初始化服务器时&#xff0c;程序会根据服务器状态的dbnum属性来决定应该创建多…

【shell漫步】2 运算符

碎碎念 上一章介绍了各种变量的定义和使用&#xff0c;这次要针对数字和文本这两种基本数据类型进行运算和判断了&#xff0c;shell中的运算包括&#xff1a; 对数字类型 算术运算&#xff08;对数字的 数学 运算&#xff09;关系运算&#xff08;用来做数字的条件判断&…

使用Go语言的HTTP客户端进行并发请求

Go语言是一种高性能、简洁的编程语言&#xff0c;它非常适合用于构建并发密集型的网络应用。在Go中&#xff0c;标准库提供了强大的HTTP客户端和服务器功能&#xff0c;使得并发HTTP请求变得简单而高效。 首先&#xff0c;让我们了解为什么需要并发HTTP请求。在许多应用场景中…

「Verilog学习笔记」任意奇数倍时钟分频

专栏前言 本专栏的内容主要是记录本人学习Verilog过程中的一些知识点&#xff0c;刷题网站用的是牛客网 timescale 1ns/1nsmodule clk_divider#(parameter dividor 5) ( input clk_in,input rst_n,output clk_out );parameter CNT_WIDTH $clog2(dividor - 1) ; reg flag1, f…

「Verilog学习笔记」编写乘法器求解算法表达式

专栏前言 本专栏的内容主要是记录本人学习Verilog过程中的一些知识点&#xff0c;刷题网站用的是牛客网 timescale 1ns/1nsmodule calculation(input clk,input rst_n,input [3:0] a,input [3:0] b,output [8:0] c);reg [8:0] data1, data2 ; assign c data2 ; always (posed…

基于ssm的订餐管理系统论文

基于JSP的订餐管理系统的设计与实现 摘要 当下&#xff0c;正处于信息化的时代&#xff0c;许多行业顺应时代的变化&#xff0c;结合使用计算机技术向数字化、信息化建设迈进。传统的订餐信息管理模式&#xff0c;采用人工登记的方式保存相关数据&#xff0c;这种以人力为主的…

微同城本地小程序源码系统:顺风车+二手市场+跑腿功能+信息发布+广告功能 带完整的搭建教程

随着移动互联网的普及&#xff0c;小程序已成为各行业进行线上业务拓展的重要工具。微同城作为一款集顺风车、二手市场、跑腿功能、信息发布和广告功能于一体的本地小程序源码系统&#xff0c;旨在满足现代城市居民的多元化需求&#xff0c;提供一个方便、快捷、实用的服务平台…

Linkage Mapper 工具参数详解——Building Network and Map Linkages

【小白一学就会无需其他教程】此文档用于解析使用Linkage Mapper 各输入输出参数详情以及可能的影响&#xff0c;并介绍了如何解释模型输出结果和输出参数&#xff0c;适合刚入手的人。篇幅很长很啰嗦&#xff0c;是因为每个参数都解释的万分细致。 从以下链接中获取内容&#…

FPGA——VIVADO生成固化文件,掉电不丢失

VIVADO生成固化文件 (1)加入代码(2)生成bin文件&#xff0c;并且下载 (1)加入代码 设计文件(.xdc)中加入这段代码: set_property CFGBVS VCCO [current_design] set_property CONFIG_VOLTAGE 3.3 [current_design] set_property BITSTREAM.GENERAL.COMPRESS true [current_de…

【SpringBoot】-Spring MVC详解

作者&#xff1a;学Java的冬瓜 博客主页&#xff1a;☀冬瓜的主页&#x1f319; 专栏&#xff1a;【Framework】 主要内容&#xff1a;SpringMVC项目的创建&#xff0c;关于使用SpringMVC框架前端传参和后端获取参数。关于SpringMVC框架后端返回数据的实战&#xff0c;如返回静…

1.2 ARCHITECTURE OF A MODERN GPU

图1.2显示了典型的支持CUDA的GPU架构的高级视图。它被组织成一系列高线程的流式多处理器&#xff08;SM&#xff09;。在图中1.2&#xff0c;两个SM构成一个 block。然而&#xff0c;构建块中的SM数量可能因代而异。此外&#xff0c;在图中&#xff0c;每个SM都有多个共享控制逻…

工作中人员离岗识别摄像机

工作中人员离岗识别摄像机是一种基于人工智能技术的智能监控设备&#xff0c;能够实时识别员工离岗状态并进行记录。这种摄像机通常配备了高清摄像头、深度学习算法和数据处理系统&#xff0c;可以精准地监测员工的行为&#xff0c;提高企业的管理效率和安全性。 工作中人员离岗…

医院信息系统集成平台—后台运维管理系统

随着信息化建设的推进,为了让凝聚了巨大人力物力投入的信息基础设施发挥出其效益,保障整个信息系统的平稳可靠运行,需要有一个可从整体上对包括服务器、网络,存储,安全等组件在内的IT基础设施环境进行综合管理的平台,并能够提供业务系统运行异常的实时告警和进行图形化问…

【Python】开始你的Python之旅(Anaconda、Pycharm、Jupyter)

Python工具准备 下载安装AnacondaPycharmJupyter Notebook 启动使用AnacondaPycharmJupyter Notebook 引言&#xff1a; 信息时代&#xff0c;计算机引领。人工智能&#xff0c;Python是基础。信息时代学习好Python乃是在人工智能时代的立足之本。 本文&#xff1a; 做好Pyth…

透明触摸屏展示柜的安装,需要注意什么

透明触摸屏展示柜的安装需要注意以下几个方面&#xff1a; 确定安装位置&#xff1a;选择一个合适的位置&#xff0c;确保展示柜的摆放位置合理&#xff0c;便于观看和管理。同时&#xff0c;要考虑到电源和信号线的连接&#xff0c;以及展示柜与周围环境的协调性。 检查透明触…

MYSQL多种提权方式

&#x1f419;MYSQL-提权条件 - 数据库的最高权限用户的密码 - secure-file-priv没进行目录限制 - 拿下了网站的权限&#xff08;通过webshell或者其他方式&#xff09; - 获取到了数据库的账号密码 &#xff08;获取密码&#xff1a;D:/phpstudy/MySQL/data/mysql/user.MYD…

【数据结构】——期末复习题库(6)

&#x1f383;个人专栏&#xff1a; &#x1f42c; 算法设计与分析&#xff1a;算法设计与分析_IT闫的博客-CSDN博客 &#x1f433;Java基础&#xff1a;Java基础_IT闫的博客-CSDN博客 &#x1f40b;c语言&#xff1a;c语言_IT闫的博客-CSDN博客 &#x1f41f;MySQL&#xff1a…

亚马逊用虚拟信用卡注册可以吗?

很多想做海外广告客户&#xff0c;由于想要投放Google、 Facebook广告&#xff0c;都需要虚拟信用卡&#xff0c;我们对信用卡研究也是有一定深入。但是&#xff0c;当在线购物或者邮件支付时&#xff0c;小伙伴们会担心信息的泄漏&#xff0c;而虚拟信用卡为付款创建了额外的安…

Android 集成vendor下的模块

Android 集成vendor下的模块 &#xff0c;只需要在 PRODUCT_PACKAGES 加上对应的模块名&#xff0c;编译的时候就会执行对应模块的bp文件&#xff0c;集成到系统中 PRODUCT_PACKAGES \WallpaperPicker \Launcher3 \com.nxp.nfc Android11 Framework Vendor下自定义系统…
最新文章