feat: 从环境变量配置子应用地址

master
钟良源 1 month ago
parent 4b6abf9161
commit 110b621375

@ -6,14 +6,18 @@ interface AppDetail {
}
export const useMicroApptore = defineStore('microApp', () => {
// 从环境变量获取子应用地址
const labelAppUrl = import.meta.env.VITE_LABEL_APP_URL || '/labelapp/'
const flowAppUrl = import.meta.env.VITE_FLOW_APP_URL || '/flowapp/'
const apps = ref<Record<string, AppDetail>>({
'label-app': {
name: 'label-app',
appUrl: ''
appUrl: labelAppUrl
},
'flow-app': {
name: 'flow-app',
appUrl: ''
appUrl: flowAppUrl
}
})

11
src/vite-env.d.ts vendored

@ -5,3 +5,14 @@ declare module '*.vue' {
const component: DefineComponent<{}, {}, any>
export default component
}
// 环境变量类型声明
interface ImportMetaEnv {
readonly VITE_USER_NODE_ENV: 'development' | 'production'
readonly VITE_LABEL_APP_URL: string
readonly VITE_FLOW_APP_URL: string
}
interface ImportMeta {
readonly env: ImportMetaEnv
}

Loading…
Cancel
Save