Skip to content

Instantly share code, notes, and snippets.

@vuejsdevelopers
Created October 31, 2017 13:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vuejsdevelopers/c8d854a8660c77bbddf9ec47e087d3de to your computer and use it in GitHub Desktop.
Save vuejsdevelopers/c8d854a8660c77bbddf9ec47e087d3de to your computer and use it in GitHub Desktop.
Build A Lazy-Load Router With Vue.js And The Latest Browser Features - Snippet 05
import BooksPage from './pages/BooksPage.js';
new Vue({
el: '#app',
data: {
page: BooksPage
},
methods: {
navigate(event) {
this.page = () => import(`./${event.target.pathname}`)
// Vue.js < 2.5.0
// .then(m => m.default)
;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment