使用的是第三方 continew-admin 项目
在 continew-admin-ui 项目中
添加 config.json 到public 目录下
- {
- "baseURL": "http://localhost:8000"
- }
在 request.ts 文件中
- async function fetchConfig() {
- const response = await fetch('/config.json');
- const data = await response.json();
- console.log('Loaded JSON data:', data);
- axios.defaults.baseURL = data.baseURL;
- }
-
- fetchConfig();