写这篇文字主要是我需要写一份vue教学文档留给公司的人,所以顺便上传到上边,希望对大家有所帮助。小弟不才,请多多包含。
一.Vue环境需要
1.nodeJS(常用指令:https://blog.csdn.net/a411360945/article/details/79944991)
2.Webpack(在项目中安装)
3.脚手架。Vue-cli
4.安装淘宝镜像:npm install cnpm -g --registry=https://registry.npm.taobao.org
二.初始化项目
- 用vue init webpack Swiper(文件名)
- 然后输入Project name:项目名称(显示在html的title内容,不能为大写,多个单词可以用“-”链接)
- 描述Project description:随意写
- 作者:Author:随意写
- Vue build:默认第一个,直接回车
- Install vue-router:yes
- Use ESLint to lint your code?:no
- Set up unit tests:no
- Setup e2e tests with Nightwatch?:no
- Yes, use NPM
- cd Swiper (进入文件夹下)
- npm run dev(启动)
三.路由布局
1.进入src下的router,打开index.js
2.新建一个组件
3.在路由中配置新组件地址:
路由传参等请看:https://github.com/youchaojun/Vue2.0-