File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 11import { getWatcher , getDep } from './util'
22
33export default function ( Vue ) {
4- Vue . mixin ( { init } )
4+ var version = Number ( Vue . version . split ( '.' ) [ 0 ] )
5+
6+ if ( version >= 2 ) {
7+ Vue . mixin ( {
8+ init : vuexInit
9+ } )
10+ } else {
11+ // override init and inject vuex init procedure
12+ // for 1.x backwards compatibility.
13+ const _init = Vue . prototype . _init
14+ Vue . prototype . _init = function ( options = { } ) {
15+ options . init = options . init
16+ ? [ vuexInit ] . concat ( options . init )
17+ : vuexInit
18+ _init . call ( this , options )
19+ }
20+ }
521
622 /**
723 * Vuex init hook, injected into each instances init hooks list.
824 */
925
10- function init ( ) {
26+ function vuexInit ( ) {
1127 const options = this . $options
1228 const { store, vuex } = options
1329 // store injection
You can’t perform that action at this time.
0 commit comments