在Vue里面环境变量必须由VUE_APP_ 开始 https://cli.vuejs.org/zh/guid... 你可以参考我的项目: docker-compose.yml: https://gitlab.com/verbose-eq... frontend: container_name: frontend build: context: ./frontend volumes: - ./frontend:/app/ - '/app/node_modules' ports: - "8080:8080" networks: - main depends_on: - backend - db environment: - NODE_ENV=development - VUE_APP_API_BASE_URL=http://localhost api.js: https://gitlab.com/verbose-eq... import axios from 'axios'; const apiCall = axios.create({ baseURL: process.env.VUE_APP_API_BASE_URL, }); export default apiCall;
在Vue里面环境变量必须由
VUE_APP_
开始https://cli.vuejs.org/zh/guid...
你可以参考我的项目:
docker-compose.yml: https://gitlab.com/verbose-eq...
api.js: https://gitlab.com/verbose-eq...