mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-18 19:55:12 +00:00
0e42e98751
* Add hasManualLoading * Add hasManualLoading (2) * Debugging * Debugging (2) * Change 'manual' to false * Add custom-page-loading example * Add custom-page-loading example (2) * Changed approach * Added custom-page-loading/README.md * Change running loading time in about.vue * Patch loadAsyncComponents * Added final page * Changed approach (2) * Fixed example * Fixed example (2) * Fix example package name * Linting * Improved examples (more to the point) * Linting (2) * Fix typo * Adjust indentation * Added noloading.vue to basic fixture * Added noloading tests * Linting (3) * Debugging test * Linting (4) * Debugging test (2) * Debugging test (3)
50 lines
984 B
Vue
50 lines
984 B
Vue
<template>
|
|
<div class="container">
|
|
<p>About Page</p>
|
|
<p>It should take 5 seconds for the loader to disappear</p>
|
|
<p>It should take 5 seconds for the route to change after you
|
|
<span class="link" @click="goToFinal">click here</span></p>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
loading: false,
|
|
asyncData() {
|
|
return new Promise((resolve) => {
|
|
setTimeout(function () {
|
|
resolve({})
|
|
}, 1000)
|
|
})
|
|
},
|
|
mounted() {
|
|
setTimeout(() => {
|
|
// Extend loader for an additional 5s
|
|
this.$nuxt.$loading.finish()
|
|
}, 5000)
|
|
},
|
|
methods: {
|
|
goToFinal() {
|
|
// Start loader immediately
|
|
this.$nuxt.$loading.start()
|
|
// Actually change route 5s later
|
|
setTimeout(() => {
|
|
this.$router.push('/final')
|
|
}, 5000)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.link {
|
|
cursor: pointer;
|
|
text-decoration: underline;
|
|
}
|
|
.container {
|
|
font-size: 20px;
|
|
text-align: center;
|
|
padding-top: 100px;
|
|
}
|
|
</style>
|