困扰很久的问题
一直都用splash 做延迟加载 但在 一些android机器上还是会有
这短暂的白屏其实就是vue页面尚未完全渲染的间隙
处理方案
在html中添加
<body>
<div id="splash-screen" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-image: url('/path/to/your/ad.png'); background-size: cover; z-index: 9999;"></div>
<div id="app"></div>
</body>
这里添加一个div在 app同级
然后再vue 挂载完成之后 移除该div
function init() {
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app');
// 移除 splash-screen
const splashScreen = document.getElementById('splash-screen');
if (splashScreen) {
splashScreen.remove();
}
}
当然 你也可以利用这短暂的间隙做一些广告/动画之类的

346

被折叠的 条评论
为什么被折叠?



