新增
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { getConfig } from '@/api/app'
|
||||
|
||||
interface AppSate {
|
||||
config: Record<string, any>
|
||||
}
|
||||
export const useAppStore = defineStore({
|
||||
id: 'appStore',
|
||||
state: (): AppSate => ({
|
||||
config: {
|
||||
domain: ''
|
||||
}
|
||||
}),
|
||||
getters: {
|
||||
getWebsiteConfig: (state) => state.config.website || {},
|
||||
getLoginConfig: (state) => state.config.login || {},
|
||||
getTabbarConfig: (state) => state.config.tabbar || [],
|
||||
getStyleConfig: (state) => state.config.style || {},
|
||||
getH5Config: (state) => state.config.webPage || {},
|
||||
getCopyrightConfig: (state) => state.config.copyright || [],
|
||||
},
|
||||
actions: {
|
||||
getImageUrl(url: string) {
|
||||
return url.indexOf('http') ? `${this.config.domain}${url}` : url
|
||||
},
|
||||
async getConfig() {
|
||||
const data = await getConfig()
|
||||
this.config = data
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user