1.1.0 • Published 4 years ago

vue-notification-components v1.1.0

Weekly downloads
85
License
MIT
Repository
github
Last release
4 years ago

vue-notification-components

基于 vue 开发的浏览器端消息弹框组件(仿 mac 系统弹框)

安装

npm 安装

npm install vue-notification-components -S

script 标签引入

<srcipt src='/dist/vue-notification-components.js'></srcipt>

引入

完整引入

import Vue from 'vue'
import App from './App.vue'

import vueNotificationComponents from 'vue-notification-components'

Vue.use(vueNotificationComponents)

new Vue({
  el: '#app',
  render: h => h(App)
})

按需引入

使用 es6 解构对象,分别使用 vue.use()即可

const {wyNotify, ...} = vueNotificationComponents

Vue.use(wyNotify)
...

组件列表

  • wyNotify
  • wyMessage

组件使用文档

wyNotify

通知提醒组件

绑定 wyNotify 方法到 Vue 实例原型链上,通过调用vue.$wyNotify(options)显示消息。下面是 options 对象的 key。(options 请使用对象类型)

键名值类型是否必填参数作用默认值
titleString选填标题
messageString选填消息内容
durationNumber选填弹框显示时间,值为 0 时不自动关闭。单位为 ms4000
showCloseBoolean选填是否显示关闭按钮false
iconSrcString选填弹框图标(用 require 或 import 引入相对路径)
onCloseFunction选填消息弹框关闭的回调
onClickFunction选填点击消息弹框触发的事件
this.$wyNotify({
        duration: 3000,
        title: '标题',
        message: '一段文字一段文字一段文字一段文字一段文字一段文字一段文字一段文字',
        showClose: true,
        iconSrc: require('../src/assets/蛙.png'),//使用require引入相对路径图片,
        onClick: function () {
          console.log('click')
        },
        onClose: function () {
          console.log('leave');
        }
      })

wyNotify


wyMessage

消息提示 使用方法与 wyNotify 类似。

键名值类型是否必填参数作用默认值
messageString选填消息内容
durationNumber选填弹框显示时间,值为 0 时不自动关闭。单位为 ms4000
showCloseBoolean选填是否显示关闭按钮false
typeString选填消息弹框的类型,可选值(info/success/error),不填或填错取默认值'info'
onCloseFunction选填消息弹框关闭的回调
onClickFunction选填点击消息弹框触发的事件

For detailed explanation on how things work, consult the docs for vue-loader.

1.1.0

4 years ago

1.0.0

4 years ago