+12
-1
@@ -3,7 +3,7 @@ import { ref } from 'vue'
|
||||
|
||||
export const useConfigStore = defineStore('config', () => {
|
||||
// API 配置
|
||||
const apiBaseUrl = ref('http://192.168.13.105')
|
||||
const apiBaseUrl = ref('')
|
||||
|
||||
// 应用配置
|
||||
const appName = ref('OPS')
|
||||
@@ -15,8 +15,18 @@ export const useConfigStore = defineStore('config', () => {
|
||||
// 设置 API 地址
|
||||
const setApiBaseUrl = (url) => {
|
||||
apiBaseUrl.value = url
|
||||
uni.setStorageSync('baseUrl', url)
|
||||
}
|
||||
|
||||
const getApiBaseUrl=()=>{
|
||||
if(apiBaseUrl.value==='')
|
||||
{
|
||||
apiBaseUrl.value=uni.getStorageSync('baseUrl')
|
||||
}
|
||||
return apiBaseUrl.value
|
||||
}
|
||||
|
||||
|
||||
// 设置主题
|
||||
const setTheme = (newTheme) => {
|
||||
theme.value = newTheme
|
||||
@@ -28,6 +38,7 @@ export const useConfigStore = defineStore('config', () => {
|
||||
version,
|
||||
theme,
|
||||
setApiBaseUrl,
|
||||
getApiBaseUrl,
|
||||
setTheme
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user