Skip to content

Commit f0cf2c6

Browse files
committed
inherit:true constructor cache should be context-sensitive (fix vuejs#1219)
1 parent 9942ace commit f0cf2c6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/api/child.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ var _ = require('../util')
1414
exports.$addChild = function (opts, BaseCtor) {
1515
BaseCtor = BaseCtor || _.Vue
1616
opts = opts || {}
17-
var parent = this
1817
var ChildVue
18+
var parent = this
19+
// transclusion context
20+
var context = opts._context || parent
1921
var inherit = opts.inherit !== undefined
2022
? opts.inherit
2123
: BaseCtor.options.inherit
2224
if (inherit) {
23-
var ctors = parent._childCtors
25+
var ctors = context._childCtors
2426
ChildVue = ctors[BaseCtor.cid]
2527
if (!ChildVue) {
2628
var optionName = BaseCtor.options.name
@@ -34,9 +36,7 @@ exports.$addChild = function (opts, BaseCtor) {
3436
)()
3537
ChildVue.options = BaseCtor.options
3638
ChildVue.linker = BaseCtor.linker
37-
// important: transcluded inline repeaters should
38-
// inherit from outer scope rather than host
39-
ChildVue.prototype = opts._context || this
39+
ChildVue.prototype = context
4040
ctors[BaseCtor.cid] = ChildVue
4141
}
4242
} else {

0 commit comments

Comments
 (0)