File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed
test/unit/features/options Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -376,13 +376,13 @@ export function mergeOptions (
376376 }
377377
378378 if ( typeof child === 'function' ) {
379- child = child . options
379+ child = child . extendOptions
380380 }
381381
382382 normalizeProps ( child , vm )
383383 normalizeInject ( child , vm )
384384 normalizeDirectives ( child )
385-
385+
386386 // Apply extends and mixins on the child options,
387387 // but only if it is a raw options object that isn't
388388 // the result of another mergeOptions call.
Original file line number Diff line number Diff line change @@ -109,4 +109,32 @@ describe('Options mixins', () => {
109109 expect ( vm . b ) . toBeDefined ( )
110110 expect ( vm . $options . directives . c ) . toBeDefined ( )
111111 } )
112+
113+ it ( 'should not mix global mixined lifecycle hook twice' , ( ) => {
114+ const spy = jasmine . createSpy ( 'global mixed in lifecycle hook' )
115+ Vue . mixin ( {
116+ created ( ) {
117+ spy ( )
118+ }
119+ } )
120+
121+ const mixin1 = Vue . extend ( {
122+ methods : {
123+ a ( ) { }
124+ }
125+ } )
126+
127+ const mixin2 = Vue . extend ( {
128+ mixins : [ mixin1 ] ,
129+ } )
130+
131+ const Child = Vue . extend ( {
132+ mixins : [ mixin2 ] ,
133+ } )
134+
135+ const vm = new Child ( )
136+
137+ expect ( typeof vm . $options . methods . a ) . toBe ( 'function' )
138+ expect ( spy . calls . count ( ) ) . toBe ( 1 )
139+ } )
112140} )
You can’t perform that action at this time.
0 commit comments