vue judge events after page elements (images, audio, etc.) have all been loaded

Export default { 
    Data () { 
        return { 
            Timer: null , // timer 
        } 
    } 
} 

Created () { 
    const that = the this 
    that.timer = the setInterval ( function () { 
        the console.log (the document.readyState) 
        IF (Document. === the readyState 'Complete' ) { 
            that._scrollToBottom () // chat box bottommost roller is pulled 
            window.clearInterval (that.timer) 
        } 
    }, 1000 ) 
},

 

The code above scenarios, --- h5 chat page, because the only node created when loading a page element came in, pictures, audio and other resources is not yet fully loaded, causing the wheel can not be pulled to the bottom

this. $ nextTick does not work

 

Guess you like

Origin www.cnblogs.com/haishen/p/10943521.html