mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 16:12:12 +00:00
feat: handle spa errors with default loading indicator
This commit is contained in:
parent
a56c208f9b
commit
b61698f44c
@ -8,6 +8,7 @@ body, html, #__nuxt {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loader,
|
.loader,
|
||||||
@ -31,6 +32,11 @@ body, html, #__nuxt {
|
|||||||
animation: load8 1.1s infinite linear;
|
animation: load8 1.1s infinite linear;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loader.error {
|
||||||
|
border-left: .5rem solid #ff4500;
|
||||||
|
animation-duration: 5s;
|
||||||
|
}
|
||||||
|
|
||||||
@-webkit-keyframes load8 {
|
@-webkit-keyframes load8 {
|
||||||
0% {
|
0% {
|
||||||
-webkit-transform: rotate(0deg);
|
-webkit-transform: rotate(0deg);
|
||||||
@ -54,6 +60,13 @@ body, html, #__nuxt {
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
window.addEventListener('error', function() {
|
||||||
|
var e = document.getElementById("loader");
|
||||||
|
if (e) e.className += " error";
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<div class="loader"><%= options.loading %></div>
|
<div class="loader"><%= options.loading %></div>
|
||||||
|
|
||||||
<%= options.dev ? '<!-- https://projects.lukehaas.me/css-loaders -->' : '' %>
|
<%= options.dev ? '<!-- https://projects.lukehaas.me/css-loaders -->' : '' %>
|
||||||
|
Loading…
Reference in New Issue
Block a user