This commit is contained in:
2026-05-18 09:38:55 +08:00
parent 634e0b9456
commit 7d1e1012d4
10 changed files with 153 additions and 46 deletions
+8 -2
View File
@@ -1,3 +1,5 @@
import store from '@/store'
// 获取合并的数据
export const mergeConfig = (_this, options) => {
//判断url是不是链接
@@ -5,10 +7,14 @@ export const mergeConfig = (_this, options) => {
let config = Object.assign({
timeout: _this.timeout
}, _this.config, options);
// 动态从 store 中获取最新的 apiUrl
const dynamicApiUrl = store.getters.apiUrl || _this.baseUrl;
if (options.method == "FILE") {
config.url = urlType ? options.url : _this.fileUrl + options.url;
config.url = urlType ? options.url : (dynamicApiUrl || _this.fileUrl) + options.url;
} else {
config.url = urlType ? options.url : _this.baseUrl + options.url;
config.url = urlType ? options.url : dynamicApiUrl + options.url;
}
//请求头
if (options.header) {