ann0707
2018-08-16 c9bc8ec61cff4076132f6396d99d383a2cdf5a03
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
 * Created by c.y on 2018/3/16.
 * 组件的命名 项目名(F---filean) + 组件的描述(区别与框架的组件)
 * vux的全局弹窗toast的重新封装,主要用于后台返回错误状态的码的提示
 * 以及input输入框不合要求的,弹出的提示。
 */
 
import Vue from 'vue';
import VueRouter from 'vue-router';
import {ToastPlugin,AlertPlugin} from 'vux';
 
Vue.use(ToastPlugin);
Vue.use(VueRouter);
Vue.use(AlertPlugin);
 
export default {
    // toast提示
    toast(text) {
        Vue.$vux.toast.show({
            width: '80%',
            type: 'text',
            time: 2000,
            position: 'middle',
            text: text
        });
    },
    // 对话框提示
    alert(text,_this,callback) {
        Vue.$vux.alert.show({
            title: '',
            content: text,
            onShow() {
                // 弹出逻辑
                console.log('show');
            },
            onHide() {
                Vue.$vux.alert.hide();
                if(callback){
                    _this.$router.push({path: '/login'});
                    callback();
                }else{
                    _this.$router.push({path: '/f-login'});
                }
 
            }
        });
    }
}