@edu-fe/vue-toast

0.0.4 • Public • Published

@edu-fe/toast

简单的全局 toast 插件实现,目前只能在 dom 环境下使用,小程序可以暂时用原生 toast

Usage

先将插件注册到全局:

import Toast from '@edu-fe/toast'

Vue.use(new Toast(), {
  template: '...'
})

注意点:

  • Mustache: Toast 内提供默认的 template,如果要重写模板,可以使用 mustache 的规范格式,如:<div>{{ title }}</div>,其数据在后面的展示方法中传入

展示:

this.$loading.show({
  message: 'Let\'s make a toast!',
  top: 100,
  bottom: 100,
  keep: 2000
})

各项意义:

  • message:如果没有重写 template 则必传,是展示在 toast 上的数据
  • top:如果传入该值,则 toast 表现为自上而下出现,该值即 toast top 值;如果同时传入了 bottom,则忽略 bottom
  • bottom:如果传入该值且没有传入 top,则 toast 表现为自下而上出现,该值即 toast bottom 值
  • keep:toast 停留的时间,单位 ms,不传则默认为 2000

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.4
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.4
    1
  • 0.0.3
    0
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i @edu-fe/vue-toast

Weekly Downloads

1

Version

0.0.4

License

none

Unpacked Size

267 kB

Total Files

6

Last publish

Collaborators

  • julywind
  • hungryyang
  • ccforeverd
  • shockw4ver