sakura/src/store
2021-08-08 22:16:57 +08:00
..
auth.ts Initial commit 2021-07-09 18:28:29 +08:00
comments.ts Add mobile compatibility 2021-08-08 00:04:05 +08:00
index.ts Add options framework 2021-07-20 11:57:41 +08:00
init.ts Bump dependencies 2021-08-08 22:16:57 +08:00
messages.ts Excute eslint 2021-08-01 10:14:43 +08:00
posts.ts Add mobile compatibility 2021-07-31 12:30:10 +08:00
README.md Initial commit 2021-07-09 18:28:29 +08:00

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)
}