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

app官网模板自动app优化下载

app官网模板,自动app优化下载,台湾门户网站有哪些,论职能网站建设悬浮出现在页面角落,显示全局的通知提醒消息。 1.如何使用? 适用性广泛的通知栏 //Notification 组件提供通知功能,Element 注册了$notify方法,接收一个options字面量参数,在最简单的情况下,你可以设置tit…

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

1.如何使用?

适用性广泛的通知栏

//Notification 组件提供通知功能,Element 注册了$notify方法,接收一个options字面量参数,在最简单的情况下,你可以设置title字段和message字段,用于设置通知的标题和正文。默认情况下,经过一段时间后 Notification 组件会自动关闭,但是通过设置duration,可以控制关闭的时间间隔,特别的是,如果设置为0,则不会自动关闭。注意:duration接收一个Number,单位为毫秒,默认为4500。<template><el-buttonplain@click="open1">可自动关闭</el-button><el-buttonplain@click="open2">不会自动关闭</el-button>
</template><script>export default {methods: {open1() {const h = this.$createElement;this.$notify({title: '标题名称',message: h('i', { style: 'color: teal'}, '这是提示文案这是提示文案这是提示文案这是提示文案这是提示文案这是提示文案这是提示文案这是提示文案')});},open2() {this.$notify({title: '提示',message: '这是一条不会自动关闭的消息',duration: 0});}}}
</script>

2.带有倾向性

带有 icon,常用来显示「成功、警告、消息、错误」类的系统消息

//Element 为 Notification 组件准备了四种通知类型:success, warning, info, error。通过type字段来设置,除此以外的值将被忽略。同时,我们也为 Notification 的各种 type 注册了方法,可以在不传入type字段的情况下像open3和open4那样直接调用。<template><el-buttonplain@click="open1">成功</el-button><el-buttonplain@click="open2">警告</el-button><el-buttonplain@click="open3">消息</el-button><el-buttonplain@click="open4">错误</el-button>
</template><script>export default {methods: {open1() {this.$notify({title: '成功',message: '这是一条成功的提示消息',type: 'success'});},open2() {this.$notify({title: '警告',message: '这是一条警告的提示消息',type: 'warning'});},open3() {this.$notify.info({title: '消息',message: '这是一条消息的提示消息'});},open4() {this.$notify.error({title: '错误',message: '这是一条错误的提示消息'});}}}
</script>

3.自定义弹出位置

可以让 Notification 从屏幕四角中的任意一角弹出

使用position属性定义 Notification 的弹出位置,支持四个选项:top-righttop-leftbottom-rightbottom-left,默认为top-right

<template><el-buttonplain@click="open1">右上角</el-button><el-buttonplain@click="open2">右下角</el-button><el-buttonplain@click="open3">左下角</el-button><el-buttonplain@click="open4">左上角</el-button>
</template><script>export default {methods: {open1() {this.$notify({title: '自定义位置',message: '右上角弹出的消息'});},open2() {this.$notify({title: '自定义位置',message: '右下角弹出的消息',position: 'bottom-right'});},open3() {this.$notify({title: '自定义位置',message: '左下角弹出的消息',position: 'bottom-left'});},open4() {this.$notify({title: '自定义位置',message: '左上角弹出的消息',position: 'top-left'});}}}
</script>

4.带有偏移

让 Notification 偏移一些位置

Notification 提供设置偏移量的功能,通过设置 offset 字段,可以使弹出的消息距屏幕边缘偏移一段距离。注意在同一时刻,所有的 Notification 实例应当具有一个相同的偏移量。

<template><el-buttonplain@click="open">偏移的消息</el-button>
</template><script>export default {methods: {open() {this.$notify({title: '偏移',message: '这是一条带有偏移的提示消息',offset: 100});}}}
</script>

5.使用 HTML 片段

message 属性支持传入 HTML 片段

dangerouslyUseHTMLString属性设置为 true,message 就会被当作 HTML 片段处理。

<template><el-buttonplain@click="open">使用 HTML 片段</el-button>
</template><script>export default {methods: {open() {this.$notify({title: 'HTML 片段',dangerouslyUseHTMLString: true,message: '<strong>这是 <i>HTML</i> 片段</strong>'});}}}
</script>

message 属性虽然支持传入 HTML 片段,但是在网站上动态渲染任意 HTML 是非常危险的,因为容易导致 XSS 攻击。因此在 dangerouslyUseHTMLString 打开的情况下,请确保 message 的内容是可信的,永远不要将用户提交的内容赋值给 message 属性。

6.隐藏关闭按钮

可以不显示关闭按钮

showClose属性设置为false即可隐藏关闭按钮。

<template><el-buttonplain@click="open">隐藏关闭按钮</el-button>
</template><script>export default {methods: {open() {this.$notify.success({title: 'Info',message: '这是一条没有关闭按钮的消息',showClose: false});}}}
</script>

7.全局方法

Element 为 Vue.prototype 添加了全局方法 $notify。因此在 vue instance 中可以采用本页面中的方式调用 Notification。

8.单独引用

单独引入 Notification:

import { Notification } from 'element-ui';

此时调用方法为 Notification(options)。我们也为每个 type 定义了各自的方法,如 Notification.success(options)。并且可以调用 Notification.closeAll() 手动关闭所有实例。

http://www.dinnco.com/news/50952.html

相关文章:

  • 南宁网站建设 醉懂网络营销策划方案案例范文
  • 住房和城乡建设部网站 城市绿地分类湘潭网站建设
  • 域名解析网站建设网络推广服务
  • 个人网站企业备案区别百度销售平台怎样联系
  • 温州网站建设哪家好搜索引擎查关键词排名的软件
  • 免费自助网站百度一下你就知道原版
  • 北京西站地铁是几号线深圳产品网络推广
  • 传统网站建设团队太原seo公司
  • 网站开发好的公司推荐网站怎么被百度收录
  • 网站设计怎么算侵权游戏代理怎么找渠道
  • 两个域名同一个网站做优化网站建设设计
  • 做糕点的网站有哪些惠州seo外包服务
  • 微信公众号开发是否需要建立网站seo工具包括
  • wordpress中没有链接2022百度seo优化工具
  • 网上做平面设计兼职不错的网站枫树seo网
  • 商务网站建设的应用百度指数特点
  • 佛山专业建站公司如何进行seo
  • PS怎么布局网站结构灰色词快速排名接单
  • 医药公司网站建设淄博头条新闻今天
  • 成都党风廉政建设平台网站站长工具国产
  • php和什么语言做网站线上销售平台都有哪些
  • 正规网站做菠菜广告新媒体营销方式有几种
  • 外国黄网站色网址好口碑关键词优化
  • 遵义网站建设公司百度关键词seo排名
  • 上海seo网站优化谷歌浏览器下载
  • 苏州吴中区做网站搜索引擎营销例子
  • 网站注册费用需要多钱百度关键词优化教程
  • wordpress查询系统搜索引擎优化的含义
  • 公司都是自己制作网站网络推广理实一体化软件
  • 政府 社区网站建设产品营销策略有哪些