Skip to content

Commit 537fcf7

Browse files
committed
fix v-repeat + custom element component
1 parent fe35b51 commit 537fcf7

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/directives/repeat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ module.exports = {
112112
$parent: this.vm
113113
})
114114
this.template = transclude(this.template, merged)
115-
this._linkFn = compile(this.template, merged)
115+
this._linkFn = compile(this.template, merged, false, true)
116116
}
117117
} else {
118118
// to be resolved later

test/unit/specs/directives/repeat_spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,23 @@ if (_.inBrowser) {
141141
expect(el.innerHTML).toBe('<p>0 1</p><p>1 2</p><p>2 3</p><!--v-repeat-->')
142142
})
143143

144+
it('custom element component', function () {
145+
var vm = new Vue({
146+
el: el,
147+
data: {
148+
items: [{a:1}, {a:2}, {a:3}]
149+
},
150+
template: '<test-component v-repeat="items"></test-component>',
151+
components: {
152+
'test-component': {
153+
template: '<p>{{$index}} {{a}}</p>',
154+
replace: true
155+
}
156+
}
157+
})
158+
expect(el.innerHTML).toBe('<p>0 1</p><p>1 2</p><p>2 3</p><!--v-repeat-->')
159+
})
160+
144161
it('nested repeats', function () {
145162
var vm = new Vue({
146163
el: el,

0 commit comments

Comments
 (0)