From b9f8ad664b5eb4c1400e389debbb0f9c27e5ee26 Mon Sep 17 00:00:00 2001 From: ktsn Date: Tue, 22 Nov 2016 13:12:27 +0900 Subject: [PATCH] global mixin should not drop scope id (fix #4266) --- src/core/instance/init.js | 1 + test/unit/features/global-api/mixin.spec.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/core/instance/init.js b/src/core/instance/init.js index 277daea1737..5e25d9ab7d3 100644 --- a/src/core/instance/init.js +++ b/src/core/instance/init.js @@ -72,6 +72,7 @@ export function resolveConstructorOptions (Ctor: Class) { Ctor.superOptions = superOptions extendOptions.render = options.render extendOptions.staticRenderFns = options.staticRenderFns + extendOptions._scopeId = options._scopeId options = Ctor.options = mergeOptions(superOptions, extendOptions) if (options.name) { options.components[options.name] = Ctor diff --git a/test/unit/features/global-api/mixin.spec.js b/test/unit/features/global-api/mixin.spec.js index 3590b5a6918..fe6fd2a14b1 100644 --- a/test/unit/features/global-api/mixin.spec.js +++ b/test/unit/features/global-api/mixin.spec.js @@ -70,4 +70,18 @@ describe('Global API: mixin', () => { expect(vm.$el.textContent).toBe('hello') }) + + // #4266 + it('should not drop scopedId', () => { + const Test = Vue.extend({}) + Test.options._scopeId = 'foo' + + Vue.mixin({}) + + const vm = new Test({ + template: '

hi

' + }).$mount() + + expect(vm.$el.children[0].hasAttribute('foo')).toBe(true) + }) })