mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +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;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.loader,
|
||||
@ -31,6 +32,11 @@ body, html, #__nuxt {
|
||||
animation: load8 1.1s infinite linear;
|
||||
}
|
||||
|
||||
.loader.error {
|
||||
border-left: .5rem solid #ff4500;
|
||||
animation-duration: 5s;
|
||||
}
|
||||
|
||||
@-webkit-keyframes load8 {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
@ -54,6 +60,13 @@ body, html, #__nuxt {
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
window.addEventListener('error', function() {
|
||||
var e = document.getElementById("loader");
|
||||
if (e) e.className += " error";
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="loader"><%= options.loading %></div>
|
||||
|
||||
<%= options.dev ? '<!-- https://projects.lukehaas.me/css-loaders -->' : '' %>
|
||||
|
Loading…
Reference in New Issue
Block a user