1.0.3 • Published 4 years ago

vue-contentbox v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

vue-contentbox

借助vue.extend完成的消息提示框。

类似小程序或Uniapp的showToast和showModal,扩展在this(vue)上直接使用组件。

目前仅支持vue2.x

Install

  • npm安装
npm install vue-contentbox --save
  • yarn安装
yarn add vue-contentbox

Usage

  1. 全局引入
//main.js
import {Toast,Modal} from "vue-contentbox";
Vue.prototype.$toast = Toast;
Vue.prototype.$modal = Modal;
  1. 页面使用
//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

paramsvalueinfo
typeinfo,success,warning,error选择其中之一
content""文本
durationdefalut:1000默认值1000/单位ms
closeFuncnull消失后触发

Modal

paramsvalueinfo
content""文本
successnull回调函数

Reference

MessageBox

More

Vue3待完成

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago