Skip to content

Commit 7c19049

Browse files
committed
refactor: use app.config.globalProperties to inject store instance to vue app
Since the installation process became very slim, removed mixin.js to just include it in store file.
1 parent d3593a2 commit 7c19049

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

src/mixin.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/store.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { reactive, computed, watch } from 'vue'
2-
import applyMixin from './mixin'
2+
import { storeKey } from './injectKey'
33
import devtoolPlugin from './plugins/devtool'
44
import ModuleCollection from './module/module-collection'
55
import { forEachValue, isObject, isPromise, assert, partial } from './util'
@@ -65,7 +65,8 @@ export class Store {
6565
}
6666

6767
install (app, injectKey) {
68-
applyMixin(app, this, injectKey)
68+
app.provide(injectKey || storeKey, this)
69+
app.config.globalProperties.$store = this
6970
}
7071

7172
get state () {

0 commit comments

Comments
 (0)