mirror of
https://github.com/mashirozx/sakura.git
synced 2024-12-12 09:54:35 +08:00
.. | ||
auth.ts | ||
comments.ts | ||
index.ts | ||
init.ts | ||
messages.ts | ||
posts.ts | ||
README.md |
Composition API version state store
Create store without Vuex
Usage:
// init in main.ts
import { applyProviders } from '@/hooks/store'
import { auth, init } from '@/store'
const app = createApp(App)
applyProviders(app, auth, init)
// or init in ancestor component
import { useProviders } from '@/hooks'
import { auth, init } from '@/store'
setup() {
useProviders(auth, init)
}
// use in child component
import { auth } from '@/store'
import { useInjector } from '@/hooks'
setup() {
const { setApplicationPassword } = useInjector(auth)
setApplicationPassword(data)
}