2021-08-08 22:16:57 +08:00
..
2021-07-09 18:28:29 +08:00
2021-08-08 00:04:05 +08:00
2021-07-20 11:57:41 +08:00
2021-08-08 22:16:57 +08:00
2021-08-01 10:14:43 +08:00
2021-07-31 12:30:10 +08:00
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)
}