1.修改环境变量后需要重启项目;
2.env.XX的文件需要放在项目根目录下,而不是src下面!!!
3.在package.json文件要配置npm命令
"scripts": {
"serve": "vue-cli-service serve --mode development",
"serve:pro": "vue-cli-service serve --mode production",
"build:pro": "vue-cli-service build --mode production",
"build:sit": "vue-cli-service build --mode development",
"lint": "vue-cli-service lint"
},
npm run serve 默认就是development环境,也可以配置这个命令