一. nodejs安装

node地址: https://nodejs.org/en/
下载TLS版本即可

二. 安装nrm

  1. # 安装
  2. $ npm install nrm -g
  3. $ nrm ls
  4. npm ---------- https://registry.npmjs.org/
  5. yarn --------- https://registry.yarnpkg.com/
  6. tencent ------ https://mirrors.cloud.tencent.com/npm/
  7. cnpm --------- https://r.cnpmjs.org/
  8. taobao ------- https://registry.npmmirror.com/
  9. npmMirror ---- https://skimdb.npmjs.com/registry/
  10. # 包源切换/添加/删除/速度测试
  11. $ nrm use tapbap
  12. $ nrm add registry http://xxxx
  13. $ nrm del taobao
  14. $ nrm test taobao

三.安装vue-cli

  1. # 安装/指定版本安装
  2. $ npm install -g @vue/cli
  3. $ npm install -g @vue/cli@4.0.1

四. 项目创建

  1. # 项目创建,根据需求他该你家组件 主要的组件有router/vuex
  2. $ vue create goweb
  3. Vue CLI v5.0.4
  4. ? Please pick a preset: (Use arrow keys)
  5. > Default ([Vue 3] babel, eslint)
  6. Default ([Vue 2] babel, eslint)
  7. Manually select features

可以使用ui界面创建项目

  1. # 启动ui服务
  2. $ vue ui

五.安装第三方插件

  1. # 官方地址 https://panjiachen.github.io/vue-element-admin-site/zh/
  2. # 克隆项目
  3. $ git clone https://github.com/PanJiaChen/vue-element-admin.git
  4. # 进入项目目录
  5. $ cd vue-element-admin
  6. # 安装依赖 这里报错拉不到包的问题,最直接的办法就是设置代理 然后多安装几遍即可
  7. $ npm install
  8. # git设置代理
  9. # 设置ss
  10. $ git config --global http.proxy 'socks5://127.0.0.1:1080'
  11. $ git config --global https.proxy 'socks5://127.0.0.1:1080'
  12. # 设置代理
  13. $ git config --global https.proxy http://127.0.0.1:1080
  14. $ git config --global https.proxy https://127.0.0.1:1080
  15. # 取消代理
  16. $ git config --global --unset http.proxy
  17. $ git config --global --unset https.proxy
  18. # 建议不要用 cnpm 安装 会有各种诡异的bug 可以通过如下操作解决 npm 下载速度慢的问题
  19. $ npm install --registry=https://registry.npm.taobao.org
  20. # 本地开发 启动项目
  21. $ npm run dev

六.vscode配置

  1. # 安装插件
  2. vetur
  3. vue
  4. # 推荐安装一些好用的扩展
  5. Auto Close Tag 自动闭合HTML标签
  6. Auto Rename Tag 修改HTML标签时,自动修改匹配的标签
  7. Beautify 代码美化
  8. ESLint ESLint 插件,高亮提示
  9. File Peek 根据路径字符串,快速定位到文件
  10. HTML CSS Support css提示(支持vue
  11. HTMLHint HTML格式提示
  12. JavaScript (ES6) code snippets ES6语法代码段
  13. Vetur Vue代码高亮及补全
  14. VS Color Picker vs颜色选择器
  15. Vue 2 Snippets Vue2代码补全
  16. open in browser 在浏览器中预览