1.2.0 • Published 5 years ago

oce-message v1.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

install

yarn install oce-message
// 或者
npm install oce-message --save
// main.js
import Vue from 'vue'
import msgPlugin from 'oce-message'

Vue.use(msgPlugin)

usage

组件有两种用法,分别是声明式和命令式

  1. 声明式

    <oce-message message="这是一条消息提示" type="success" />
  1. 命令式

    // 装插件后,方法已经挂载在Vue实例上,可以全局访问
    
    // 最简单的用法
    vm.notify('这是一条消息提示')
    
    // 更多配置
    vm.notify({
      message: '这是一条消息提示',
      type: 'success',
      showCloseButton: true
    })
    
    // notify方法返回了一个手动销毁的组件方法
    const close = vm.notify(...)
    close()

options

参数说明类型可选值默认值
message消息文字String
type主题Stringnormal/success/warning/errornormal
location消息出现的位置Stringtop-center/top-right/top-left/bottom-center/bottom-right/bottom-lefttop-center
className自定义类名String
duration显示时间, 毫秒。设为 0 则不会自动关闭Number2000
showCloseButton是否显示关闭按钮Booleanfalse