mirror of
https://github.com/m1k1o/neko.git
synced 2025-08-06 02:09:04 +02:00
refactor progress
This commit is contained in:
parent
d497806443
commit
8ba1b68a21
55 changed files with 4899 additions and 761 deletions
46
client/src/store/client.ts
Normal file
46
client/src/store/client.ts
Normal file
|
@ -0,0 +1,46 @@
|
|||
import { getterTree, mutationTree, actionTree } from 'typed-vuex'
|
||||
import { accessor } from '~/store'
|
||||
|
||||
export const namespaced = true
|
||||
|
||||
export const state = () => {
|
||||
let side = false
|
||||
let _side = localStorage.getItem('side')
|
||||
if (_side) {
|
||||
side = _side === '1'
|
||||
}
|
||||
|
||||
let tab = 'chat'
|
||||
let _tab = localStorage.getItem('tab')
|
||||
if (_tab) {
|
||||
tab = _tab
|
||||
}
|
||||
|
||||
return {
|
||||
side,
|
||||
about: false,
|
||||
about_page: '',
|
||||
tab,
|
||||
}
|
||||
}
|
||||
|
||||
export const getters = getterTree(state, {})
|
||||
|
||||
export const mutations = mutationTree(state, {
|
||||
setTab(state, tab: string) {
|
||||
state.tab = tab
|
||||
localStorage.setItem('tab', tab)
|
||||
},
|
||||
setAbout(state, page: string) {
|
||||
state.about_page = page
|
||||
},
|
||||
toggleAbout(state) {
|
||||
state.about = !state.about
|
||||
},
|
||||
toggleSide(state) {
|
||||
state.side = !state.side
|
||||
localStorage.setItem('side', state.side ? '1' : '0')
|
||||
},
|
||||
})
|
||||
|
||||
export const actions = actionTree({ state, getters, mutations }, {})
|
Loading…
Add table
Add a link
Reference in a new issue