wuxw
2020-01-14 69e2baf5518079bfc16cfadc2fb29842fb3de85d
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
(function(vc){
 
    var vm = new Vue({
        el:'#message',
        data:{
            messageInfo:{
                hide:true,
                errorInfo:'网络超时,请检查网络!'
            }
        },
        mounted:function(){
 
        },
        methods:{
            //验证码定时
            messageTimer:function(){
                  var num = 10;
                var _timer = vc.createTimer(function(){
                    num --;
                    if(num === 1){
                        vc.clearTimer(_timer);
                        vm.messageInfo.hide=true;
                    }
                },1000);
            }
        }
    });
 
    vm.$on('message_openMessage',function(_msg){
        //console.log("开始加载");
        vm.messageInfo.hide = false;
        vm.messageInfo.errorInfo = _msg.msg;
    });
    /**
        加载遮罩层
        @param _msg 提示内容
        @param _notAutoHide 是否需要自动隐藏
    **/
    vc.message = function(_msg, _notAutoHide){
       vm.$emit('message_openMessage',{msg:_msg});
       if(!_notAutoHide){
            vm.messageTimer();
       }
 
    }
})(window.vc)