Vue-Router
Vue-Router是用来将一个Vue程序的多个页面进行路由的。比如一个Vue程序(或者说一个网站)有登录、注册、首页等模块,那么我们就可以定义/login、/register、/来映射每个模块。
安装:
- 通过
script加载进来:<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>。 - 通过
npm安装:npm install vue-router。
文档:
- 官方文档:
https://router.vuejs.org/zh/。 - github地址:
https://github.com/vuejs/vue-router。