1. npm 使用注意事项:
a. node.js 使用 v8.16.0 版本,使用 v10 版本会有各种莫名其妙的报错
b. 开箱先改淘宝镜像:
npm config set registry https://registry.npm.taobao.org
c. 解决下载 node-sass 报错:
npm set sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
d. npm config 相关命令:
npm config set <key> <value>
npm config get [<key>]
npm config delete <key>
npm config list [--json]
npm config edit
npm set <key> <value>
npm get [<key>]
e. 其它实用命令:
npm cache clean --force
1. mock 数据修改为使用自己的后台接口
2. 修改 axios 的 baseURL 配置注意事项
3. Dev模式启动,打开两次启动页面问题
a. 找到 vue.config.js 文件,将 devServer -> open 处改为false
1 devServer: { 2 port: port, 3 open: false, 4 overlay: { 5 warnings: false, 6 errors: true 7 } 8 }
b. 修改 package.json文件,在 Dev 模式启动脚本后增加参数`--open`
1 "dev": "vue-cli-service serve --open",