Created
October 31, 2017 13:26
-
-
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
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
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