Skip to content

Instantly share code, notes, and snippets.

@trainiac
Created December 18, 2018 11:18
Show Gist options
  • Save trainiac/366f53cb6e561581f54041db6ffdeac1 to your computer and use it in GitHub Desktop.
Save trainiac/366f53cb6e561581f54041db6ffdeac1 to your computer and use it in GitHub Desktop.
An example of defining custom route hooks in a component.
<script>
export default {
name: 'MyRouteComponent',
permissions(store, to, from) {
// request permissions data
// return a promise to resolve or reject navigation
},
criticalData(store, to, from) {
// request critical data
// return a promise so that data can finish loading during Server Request lifecycle
},
lazyData (store, to, from) {
// request lazy data
// no need to return a promise because nothing should wait on it
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment