1.0.3 • Published 4 years ago
vue-contentbox v1.0.3
vue-contentbox
借助vue.extend完成的消息提示框。
类似小程序或Uniapp的showToast和showModal,扩展在this(vue)上直接使用组件。
目前仅支持vue2.x
Install
- npm安装
npm install vue-contentbox --save
- yarn安装
yarn add vue-contentbox
Usage
- 全局引入
//main.js
import {Toast,Modal} from "vue-contentbox";
Vue.prototype.$toast = Toast;
Vue.prototype.$modal = Modal;
- 页面使用
//xxx.vue
this.$toast.info("Hello world");
this.$toast({
type: "info",
content: "Hello world"
})
this.$modal({
content: "Hello world",
success:(res)=>{
if(res.confirm)
console.log("OK");
else
console.log("Error");
}
})
配置项
Toast
params | value | info |
---|---|---|
type | info,success,warning,error | 选择其中之一 |
content | "" | 文本 |
duration | defalut:1000 | 默认值1000/单位ms |
closeFunc | null | 消失后触发 |
Modal
params | value | info |
---|---|---|
content | "" | 文本 |
success | null | 回调函数 |
Reference
More
Vue3待完成