# Toast组件

# 使用教程

点击查看教程

# 使用文档

# 导入

main.js中:

import { Toast } from 'cpm-ui'
Vue.use(Toast)
1
2

# 调用

挂载在vue.prototype上,vue实例中,直接使用 this.$toast({options}) 使用。

this.$toast('系统出错,稍后重试');

this.$toast({
  propsData: {
    message: '系统出错,稍后重试',
    type: 'error'
  },
  methods: {
    callback () {
      console.log('toast消失了')
    }
  }
});
1
2
3
4
5
6
7
8
9
10
11
12
13

# 属性props(propsData)

参数 说明 类型 可选值 默认值
position toast显示的位置 String topmiddlebottom middle
wrapStyleObj toast样式 Object {}
message toast显示的文案 String ''
time toast显示的时间 Number 2000
type toast类型(icon) String successinfoerror ''

# 初始化created或mounted

# 方法methods

方法 说明
callback toast消失回调
remove 移除toast

# 特别提示

Last Updated: 12/12/2019, 7:37:32 PM

注:因PC端浏览存在最小12px字号的原因,部分视图下文字会显示比较大,手机端访问正常。