前提是已经安装了npm和Vue以及脚手架vue-cli
1、创建项目
vue init webpack 项目名
2、进入项目文件夹
cd tab键
3、运行项目
npm run start
4、App.vue全局配置
此文件内的内容不会随路由改变而改变,通常导航条就写在这里

5、index.js 配置路由
routes对象内配置,一个大括号表示一个路由,path、name、component
path:对应路径
name:名
component:组件 * 需要去src/component文件夹下创建一个vue文件,把HelloWorld文件中的script内容复制过来改吧改吧

参考文件
https://laravelcode.cn/posts/37/vue-cli-was-introduced-to-bootstrap4
https://router.vuejs.org/zh/guide/essentials/nested-routes.html
网友评论