Created
January 25, 2018 08:27
-
-
Save nemanja947/5efef404d2c8e242b9d84dda4fb92b18 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div id="app"> | |
<!-- for example router view --> | |
<router-view></router-view> | |
</div> | |
</template> | |
<script> | |
export default { | |
mounted () { | |
// [App.vue specific] When App.vue is finish loading finish the progress bar | |
NProgress.done(); | |
}, | |
created () { | |
// [App.vue specific] When App.vue is first loaded start the progress bar | |
NProgress.start(); | |
// hook the progress bar to start before we move router-view | |
this.$router.beforeEach((to, from, next) => { | |
// start the progress bar | |
NProgress.start(); | |
// continue to next page | |
next() | |
}) | |
// hook the progress bar to finish after we've finished moving router-view | |
this.$router.afterEach((to, from) => { | |
// finish the progress bar | |
NProgress.done(); | |
}) | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment