1.相关文件
src/App.vue
2.相关代码
<template> <div id="app" class="loading"> <router-view/> </div> </template>
mounted: function () { let ele = document.getElementById('app') setTimeout(function () { ele.classList.remove('loading') }, 1500) }
#app{ height: 100%; } .loading:before{ content: ''; position: fixed; width: 100%; height: 100%; left:0; top:0; background:#fff url(/static/img/loading.gif) center center no-repeat; z-index: 99999999; }