Skip to content

Commit c57ba3e

Browse files
ktsnyyx990803
authored andcommitted
global mixin should not drop scope id (fix vuejs#4266) (vuejs#4274)
1 parent b45b974 commit c57ba3e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/core/instance/init.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export function resolveConstructorOptions (Ctor: Class<Component>) {
7272
Ctor.superOptions = superOptions
7373
extendOptions.render = options.render
7474
extendOptions.staticRenderFns = options.staticRenderFns
75+
extendOptions._scopeId = options._scopeId
7576
options = Ctor.options = mergeOptions(superOptions, extendOptions)
7677
if (options.name) {
7778
options.components[options.name] = Ctor

test/unit/features/global-api/mixin.spec.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,18 @@ describe('Global API: mixin', () => {
7070

7171
expect(vm.$el.textContent).toBe('hello')
7272
})
73+
74+
// #4266
75+
it('should not drop scopedId', () => {
76+
const Test = Vue.extend({})
77+
Test.options._scopeId = 'foo'
78+
79+
Vue.mixin({})
80+
81+
const vm = new Test({
82+
template: '<div><p>hi<p></div>'
83+
}).$mount()
84+
85+
expect(vm.$el.children[0].hasAttribute('foo')).toBe(true)
86+
})
7387
})

0 commit comments

Comments
 (0)