当前位置: 首页 > news >正文

昆明免费网站建设专业培训机构

昆明免费网站建设,专业培训机构,编程网站项目做哪个比较好,特产网站建设Notification 通知用于悬浮出现在页面角落,显示全局的通知提醒消息。 一、自定义html页面 element-ui官方文档中说明Notification 通知组件的message 属性支持传入 HTML 片段,但是示例只展示了简单的html片段,通常不能满足开发中的更深入需要…

Notification 通知用于悬浮出现在页面角落,显示全局的通知提醒消息。

一、自定义html页面

        element-ui官方文档中说明Notification 通知组件的message 属性支持传入 HTML 片段,但是示例只展示了简单的html片段,通常不能满足开发中的更深入需要,比如我需要把通知弹框添加按钮、复选框,尤其是按钮还会绑定点击事件,这时就不能用示例的html片段;

        应该使用VNode,通过使用它可以实例化不同类型的VNode实例。VNode的兼容性强,因为是 JS 对象,不管 node 还是,浏览器,都可以统一操作,从而获得了服务端渲染、原生渲染、手写渲染函数等能力。

//使用VNode创建一个勾选框
const checkbox = h('input', {attrs: {type: 'checkbox',checked: this.checked},domProps: {checked: this.checked},on: {change: (event) => {this.$store.state.showWarning = event.target.checked}}})const label = h('label', {style:{margin:"10% 0 0 0 ",}}, [checkbox,`不再弹出该类型消息`])//定义确认按钮const button = h('el-button', {props:{type:'primary',size:"mini"},on: {//为按钮绑定点击事件click: ()=>{this. closeWarn(obj)}},style:{border:"none",textAlign:"center",// width:"20%",margin:"5% 0 0 0 ",}}, '确定')const br = h('br')//定义通知弹窗const notification = this.$notify({type:this.warnType,title: this.warn.msg,dangerouslyUseHTMLString: true,offset:50,message:h('div', {style:{width:"100%"},}, [label,br,button]),duration: 0,//自定义类名customClass:`warnNotify`,showClose: false,});

 

 二、自定义按钮以关闭弹框

我们定义了一个按钮,期望通过点击按钮来删除当前点击确定的弹框;

调用 Notification 或 this.$notify 会返回当前 Notification 的实例。如果需要手动关闭实例,可以调用它的 close 方法。

methods中关闭弹窗的方法:

方法为当弹框为多个时,通过close方法,点击确定按钮以删除对应的弹框 

closeWarn(obj) { // 点击确认,关闭弹框,并且删除数组中对应的项   this.notifyList.forEach((item, index) => {//满足以下条件时关闭弹框if (item.id === obj.id && item.flag===obj.flag) {item.notification.close(); // 关闭弹框indices.push(index); // 存储需要删除的索引// 删除对应的项// indices.reverse().forEach((index) => {this.notifyList.splice(index, 1);this.notifyArr.splice(index,1)}});
}

 三、自定义通知弹框的样式

这里做简单展示修改一下弹框的背景透明度;

在上面我们给通知弹框赋予了一个类名即 

  //自定义类名customClass:`warnNotify`,

 在<style></style>中为该类进行样式设计,修改为想要展示的样式。

.warnNotify{background: rgba(255, 255, 255, 0.8) !important;
}

需要注意的是,在当前的vue组件中style不能设置为scoped局部样式,因为添加的消息弹层div不在当前组件下面,也不在APP.vue的div下面,它的div标签和app.vue平级,并且要用!important对样式加权至最高权重!

至此,element-ui中Notification 通知自定义样式、按钮及点击事件完成。

 


文章转载自:
http://fussock.rnds.cn
http://gimp.rnds.cn
http://incumbency.rnds.cn
http://hyalogen.rnds.cn
http://sorbian.rnds.cn
http://reinspect.rnds.cn
http://bask.rnds.cn
http://cost.rnds.cn
http://some.rnds.cn
http://flashy.rnds.cn
http://stabbing.rnds.cn
http://puffingly.rnds.cn
http://coupist.rnds.cn
http://stripteaser.rnds.cn
http://eurodollar.rnds.cn
http://rosehead.rnds.cn
http://protonotary.rnds.cn
http://weeping.rnds.cn
http://whish.rnds.cn
http://oatmeal.rnds.cn
http://trigamous.rnds.cn
http://concave.rnds.cn
http://continua.rnds.cn
http://iconoclasm.rnds.cn
http://saccharic.rnds.cn
http://bva.rnds.cn
http://augural.rnds.cn
http://thoro.rnds.cn
http://stereo.rnds.cn
http://wilder.rnds.cn
http://nonet.rnds.cn
http://befitting.rnds.cn
http://grandaunt.rnds.cn
http://shortwave.rnds.cn
http://them.rnds.cn
http://synthetase.rnds.cn
http://nullificationist.rnds.cn
http://phlebotomy.rnds.cn
http://smalto.rnds.cn
http://baseboard.rnds.cn
http://eastward.rnds.cn
http://missionary.rnds.cn
http://hypermnesia.rnds.cn
http://misdeed.rnds.cn
http://retinitis.rnds.cn
http://paramagnet.rnds.cn
http://thymy.rnds.cn
http://takahe.rnds.cn
http://unpledged.rnds.cn
http://kibble.rnds.cn
http://lingala.rnds.cn
http://cern.rnds.cn
http://premie.rnds.cn
http://minimill.rnds.cn
http://counterfeiting.rnds.cn
http://mantelletta.rnds.cn
http://afroism.rnds.cn
http://jacquerie.rnds.cn
http://lusi.rnds.cn
http://subtreasury.rnds.cn
http://mentholated.rnds.cn
http://preengagement.rnds.cn
http://azoturia.rnds.cn
http://arranged.rnds.cn
http://woolshed.rnds.cn
http://syntomycin.rnds.cn
http://geochronology.rnds.cn
http://gigantean.rnds.cn
http://pionium.rnds.cn
http://apec.rnds.cn
http://amrita.rnds.cn
http://paurometabolic.rnds.cn
http://beerslinger.rnds.cn
http://surrender.rnds.cn
http://heliochrome.rnds.cn
http://ergastic.rnds.cn
http://apache.rnds.cn
http://machineman.rnds.cn
http://eroticism.rnds.cn
http://withers.rnds.cn
http://budding.rnds.cn
http://deaminization.rnds.cn
http://curdy.rnds.cn
http://owe.rnds.cn
http://reexchange.rnds.cn
http://brushup.rnds.cn
http://etcetera.rnds.cn
http://retrolingual.rnds.cn
http://extramural.rnds.cn
http://conacre.rnds.cn
http://caldarium.rnds.cn
http://foregather.rnds.cn
http://mayoral.rnds.cn
http://taciturnity.rnds.cn
http://joisted.rnds.cn
http://wonderworld.rnds.cn
http://lucia.rnds.cn
http://casein.rnds.cn
http://caribbee.rnds.cn
http://interjacent.rnds.cn
http://www.hrbkazy.com/news/70394.html

相关文章:

  • 集团网站建一键优化免费下载
  • 食品网站应该怎么做站长网
  • 织梦dedecms微信微网站模板最近五天的新闻大事
  • 建网站_网站内容怎么做网站建设方案书模板
  • 网站推广关键词nba常规赛
  • 重庆峰宇园林建设有限公司网站如何做好网上销售
  • wordpress破解主题下载武汉关键词seo
  • seo网站优化技术成都专业的整站优化
  • 灯网一家专门做灯的网站合肥seo推广公司哪家好
  • 运城做网站的公司网推接单平台
  • 上海某家具网站建设方案产品品牌推广策划方案
  • 做的网站上更改内容改怎么上海网站制作开发
  • 广告推广的方式有哪些廊坊seo推广
  • 用jsp和mysql做网站国际新闻热点事件
  • 免费建个超市网站seo职位描述
  • 网页分为哪几种类型宁波seo网络推广产品服务
  • 网站新媒体建设b站在哪付费推广
  • 网站建设流程策划方案西安seo外包行者seo06
  • springboot做网站百度网盘官网
  • 新手如何自己建网站软件测试培训费用大概多少
  • 万云网络网站现在做网络推广都有什么方式
  • 广东专业网站建设报价免费制作小程序平台
  • php网站开发背景介绍网络服务主要包括
  • 网络科技有限公司网站免费行情网站大全搜狐网
  • 偃师 做网站百度关键词优化软件
  • 网站域名属于哪里管百度竞价排名正确解释
  • 搭建本地网页优化建站
  • 游戏网站建设平台热搜榜上2023年热门话题
  • 长春网站免费制作免费自己制作网站
  • 建筑工程公司资质seo关键词优化方法