mirror of
https://github.com/pure-admin/pure-admin-thin.git
synced 2025-12-06 18:30:34 +08:00
release: update 5.1.0
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { App } from "vue";
|
||||
import type { App } from "vue";
|
||||
import axios from "axios";
|
||||
|
||||
let config: object = {};
|
||||
@@ -8,7 +8,7 @@ const setConfig = (cfg?: unknown) => {
|
||||
config = Object.assign(config, cfg);
|
||||
};
|
||||
|
||||
const getConfig = (key?: string): ServerConfigs => {
|
||||
const getConfig = (key?: string): PlatformConfigs => {
|
||||
if (typeof key === "string") {
|
||||
const arr = key.split(".");
|
||||
if (arr && arr.length) {
|
||||
@@ -27,11 +27,11 @@ const getConfig = (key?: string): ServerConfigs => {
|
||||
};
|
||||
|
||||
/** 获取项目动态全局配置 */
|
||||
export const getServerConfig = async (app: App): Promise<undefined> => {
|
||||
export const getPlatformConfig = async (app: App): Promise<undefined> => {
|
||||
app.config.globalProperties.$config = getConfig();
|
||||
return axios({
|
||||
method: "get",
|
||||
url: `${VITE_PUBLIC_PATH}serverConfig.json`
|
||||
url: `${VITE_PUBLIC_PATH}platform-config.json`
|
||||
})
|
||||
.then(({ data: config }) => {
|
||||
let $config = app.config.globalProperties.$config;
|
||||
@@ -45,7 +45,7 @@ export const getServerConfig = async (app: App): Promise<undefined> => {
|
||||
return $config;
|
||||
})
|
||||
.catch(() => {
|
||||
throw "请在public文件夹下添加serverConfig.json配置文件";
|
||||
throw "请在public文件夹下添加platform-config.json配置文件";
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user