vue element-ui 的 Message 消息提示 在 iframe 中滚动父页面的 scroll 时 Message 固定悬浮失效解决方案!

 this_.$message({

                                showClose: true,

                                message: '我是成功消息!',

                                type: 'success',

                                duration:1000,

                                offset: this_.getWindowScrollTop(window.parent)

                            });

 

 

 getWindowScrollTop:function(win){
                    var scrollTop=0; 
                if(win.document.documentElement&&win.document.documentElement.scrollTop){
                    scrollTop=win.document.documentElement.scrollTop;
                }else if(win.document.body){ 
                    scrollTop=win.document.body.scrollTop;
                }
                return scrollTop;
            },
 getWindowHeight:function(win){
                var clientHeight=0;
                if(win.document.body.clientHeight&&win.document.documentElement.clientHeight){
                    clientHeight = (win.document.body.clientHeightwin.document.documentElement.clientHeight)?win.document.body.clientHeight:win.document.documentElement.clientHeight;
                }
                return clientHeight;
            },

 

你可能感兴趣的:(vue,element-ui)