mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-06-09 17:49:53 +08:00
🐛 Fix: i18n bug
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { reactive, InjectionKey, readonly, App, UnwrapRef } from 'vue'
|
||||
import { reactive, InjectionKey, readonly, App, UnwrapRef, ref } from 'vue'
|
||||
import { saveConfig } from '@/utils/dataSender'
|
||||
|
||||
export interface IState {
|
||||
@@ -8,6 +8,7 @@ export interface IState {
|
||||
export interface IStore {
|
||||
state: UnwrapRef<IState>
|
||||
setDefaultPicBed: (type: string) => void;
|
||||
updateForceUpdateTime: () => void;
|
||||
}
|
||||
|
||||
export const storeKey: InjectionKey<IStore> = Symbol('store')
|
||||
@@ -17,6 +18,8 @@ const state: IState = reactive({
|
||||
defaultPicBed: 'smms'
|
||||
})
|
||||
|
||||
const forceUpdateTime = ref<number>(Date.now())
|
||||
|
||||
// methods
|
||||
const setDefaultPicBed = (type: string) => {
|
||||
saveConfig({
|
||||
@@ -24,14 +27,19 @@ const setDefaultPicBed = (type: string) => {
|
||||
'picBed.uploader': type
|
||||
})
|
||||
state.defaultPicBed = type
|
||||
console.log(state)
|
||||
}
|
||||
|
||||
const updateForceUpdateTime = () => {
|
||||
forceUpdateTime.value = Date.now()
|
||||
}
|
||||
|
||||
export const store = {
|
||||
install (app: App) {
|
||||
app.provide(storeKey, {
|
||||
state: readonly(state),
|
||||
setDefaultPicBed
|
||||
setDefaultPicBed,
|
||||
updateForceUpdateTime
|
||||
})
|
||||
app.provide('forceUpdateTime', forceUpdateTime)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user