Installing and initializing Vue-router

Similar to how we added Vue and Vuex to our applications, you can either directly include the library from unpkg, or head to the following URL and download a local copy for yourself: https://unpkg.com/Vue-router. Add the JavaScript to a new HTML document, along with Vue, and your application's JavaScript. Create an application container element, your view, as well. In the following example, I have saved the Vue-router JavaScript file as router.js:

<!DOCTYPE html><html><head>  <title></title></head><body>  <div id="app"></div>  <script type="text/javascript" src="js/vue.js"></script>  <script type="text/javascript" src="js/router.js"></script>  <script type="text/javascript" src="js/app.js"></script></body> ...

Get Vue.js 2.x by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.