File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,16 @@ exports.use = function (plugin) {
100
100
return this
101
101
}
102
102
103
+ /**
104
+ * Apply a global mixin by merging it into the default
105
+ * options.
106
+ */
107
+
108
+ exports . mixin = function ( mixin ) {
109
+ var Vue = _ . Vue
110
+ Vue . options = _ . mergeOptions ( Vue . options , mixin )
111
+ }
112
+
103
113
/**
104
114
* Create asset registration methods with the following
105
115
* signature:
Original file line number Diff line number Diff line change @@ -57,6 +57,21 @@ describe('Global API', function () {
57
57
delete Vue . options . directives [ 'plugin-test' ]
58
58
} )
59
59
60
+ it ( 'global mixin' , function ( ) {
61
+ var options = Vue . options
62
+ var spy = jasmine . createSpy ( 'global mixin' )
63
+ Vue . mixin ( {
64
+ created : function ( ) {
65
+ spy ( this . $options . myOption )
66
+ }
67
+ } )
68
+ new Vue ( {
69
+ myOption : 'hello'
70
+ } )
71
+ expect ( spy ) . toHaveBeenCalledWith ( 'hello' )
72
+ Vue . options = options
73
+ } )
74
+
60
75
describe ( 'Asset registration' , function ( ) {
61
76
62
77
var Test = Vue . extend ( )
You can’t perform that action at this time.
0 commit comments