default
安装我的插件
//npm install xbplugin --save
use plugin
//main.js
//import xbplugin from 'xbplugin'
// Vue.use(xbplugin)
api
vue文件中使用 this.$xbplugin.showToast(option)
js文件中使用 两种方式
1. Vue.prototype.$xbplugin.showToast(option)
2. 步骤
>1 import Vue from 'vue';
>2 const vm = new Vue();
>3 vm.$xbplugin.showToast(option)
param
optioin{
对应字段如下
type: object,
required: true
}
//标题
title: {
type: String,
default: '提示'
}
//内容
content: {
type: String,
default: ''
}
//类型
type: {
type: String,
default: 'success' //默认成功 //warning警告 error报错
}
//自动消除时间 单位ms
duration:{
type: Number,
required: false,
default: 1500
}
//是否显示关闭按钮
closeTag:{
type: Boolean,
default: false
}
event listening
对应的事件监听
this.$xbplugin
.showToast({})
.$on('cancel',(res)=>{ //res == 0})