Skip to content

Commit

Permalink
fix component yields inside each blocks (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Jan 4, 2017
1 parent 5755334 commit 57ba95e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/generators/dom/visitors/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default {
generator.generateBlock( node, yieldName );

generator.current.builders.init.addLine(
`var ${name}_yieldFragment = ${yieldName}( root, component );`
`var ${name}_yieldFragment = ${yieldName}( ${generator.current.params}, component );`
);

generator.current.builders.update.addLine(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>{{yield}}</p>
3 changes: 3 additions & 0 deletions test/generator/component-yield-multiple-in-each/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
html: '<p>Hello Alice</p><p>Hello Bob</p><p>Hello Charles</p>'
};
19 changes: 19 additions & 0 deletions test/generator/component-yield-multiple-in-each/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{#each people as person}}
<Widget>Hello {{person}}</Widget>
{{/each}}

<script>
import Widget from './Widget.html';

export default {
data () {
return {
people: [ 'Alice', 'Bob', 'Charles' ]
};
},

components: {
Widget
}
};
</script>

0 comments on commit 57ba95e

Please sign in to comment.