File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -5,15 +5,27 @@ import cloneDeep from 'lodash/cloneDeep'
5
5
6
6
function createLocalVue ( ) : Component {
7
7
const instance = Vue . extend ( )
8
- instance . version = Vue . version
9
- instance . _installedPlugins = [ ]
8
+
9
+ // clone global APIs
10
+ Object . keys ( Vue ) . forEach ( key => {
11
+ if ( ! instance . hasOwnProperty ( key ) ) {
12
+ instance [ key ] = cloneDeep ( Vue [ key ] )
13
+ }
14
+ } )
15
+
16
+ // config is not enumerable
10
17
instance . config = cloneDeep ( Vue . config )
11
- instance . util = cloneDeep ( Vue . util )
12
- instance . _use = instance . use
18
+
19
+ // option merge strategies need to be exposed by reference
20
+ // so that merge strats registered by plguins can work properly
21
+ instance . config . optionMergeStrategies = Vue . config . optionMergeStrategies
22
+
23
+ const use = instance . use
13
24
instance . use = ( plugin ) => {
25
+ // compat for vue-router < 2.7.1
14
26
plugin . installed = false
15
27
plugin . install . installed = false
16
- instance . _use ( plugin )
28
+ use . call ( instance , plugin )
17
29
}
18
30
return instance
19
31
}
You can’t perform that action at this time.
0 commit comments