Feature(custom): update i18n force update

This commit is contained in:
Kuingsmile
2024-06-13 11:13:58 +08:00
parent 5ddc182bd1
commit e9c386d5d8
14 changed files with 54 additions and 91 deletions
+2 -11
View File
@@ -1,4 +1,4 @@
import { reactive, InjectionKey, readonly, App, UnwrapRef, ref } from 'vue'
import { reactive, InjectionKey, readonly, App, UnwrapRef } from 'vue'
import { saveConfig } from '@/utils/dataSender'
import { configPaths } from '#/utils/configPaths'
@@ -9,7 +9,6 @@ export interface IState {
export interface IStore {
state: UnwrapRef<IState>
setDefaultPicBed: (type: string) => void
updateForceUpdateTime: () => void
}
export const storeKey: InjectionKey<IStore> = Symbol('store')
@@ -19,8 +18,6 @@ const state: IState = reactive({
defaultPicBed: 'smms'
})
const forceUpdateTime = ref<number>(Date.now())
// methods
const setDefaultPicBed = (type: string) => {
saveConfig({
@@ -30,17 +27,11 @@ const setDefaultPicBed = (type: string) => {
state.defaultPicBed = type
}
const updateForceUpdateTime = () => {
forceUpdateTime.value = Date.now()
}
export const store = {
install (app: App) {
app.provide(storeKey, {
state: readonly(state),
setDefaultPicBed,
updateForceUpdateTime
setDefaultPicBed
})
app.provide('forceUpdateTime', forceUpdateTime)
}
}