mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 18:40:22 +08:00
16 lines
350 B
TypeScript
16 lines
350 B
TypeScript
type ProxyItem = [string, string];
|
|
|
|
type ProxyList = ProxyItem[];
|
|
|
|
export function createProxy(list: ProxyList) {
|
|
const ret: any = {};
|
|
for (const [prefix, target] of list) {
|
|
ret[prefix] = {
|
|
target: target,
|
|
changeOrigin: true,
|
|
rewrite: (path: string) => path.replace(new RegExp(`^${prefix}`), ''),
|
|
};
|
|
}
|
|
return ret;
|
|
}
|