sunui-msg 顶部消息提醒
v1.0.0 于 2020.01.14更新:如果消息提示直接进入页面就显示,要在mounted生命周期或者在onLoad生命周期使用this.$nextTick
参数介绍(通过ref标识):
示例代码:
<template> <view class="content"> <image class="logo" src="/static/logo.png" @click="openMsg"></image> <sunui-msg ref="msg"></sunui-msg> </view> </template> <script> import sunUimsg from '@/components/sunui-msg/sunui-msg.vue'; export default { data() { return { title: 'Hello' } }, mounted() { }, components: { 'sunui-msg': sunUimsg }, onLoad() { }, methods: { openMsg() { this.$refs.msg.show({ text: '提交失败', type: 'error', sec: 2 }); // this.$refs.msg.show({ // text: '提交成功', // type: 'success', // sec: 2 // }); // 关于自定义弹出颜色可以在sunui-msg.vue样式扩展也可以在App.vue // .sunui-color-success // .sunui-color-error // 类似以上形式扩展 } } } </script> <style> </style>
点击下载示例:sunui-msg
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。