mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-09-06 07:56:56 +08:00
✨ Feature(custom): update i18n force update
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user