Merge pull request #226 from sveltejs/gh-221

SSR – handle component directives at positions other than end
pull/227/head
Rich Harris 8 years ago committed by GitHub
commit 2a13e29a31

@ -8,7 +8,8 @@ export default {
}
}
const props = node.attributes.map( attribute => {
const props = node.attributes
.map( attribute => {
if ( attribute.type !== 'Attribute' ) return;
let value;
@ -30,7 +31,9 @@ export default {
}
return `${attribute.name}: ${value}`;
}).join( ', ' );
})
.filter( Boolean )
.join( ', ' );
let open = `\${template.components.${node.name}.render({${props}}`;

@ -0,0 +1,13 @@
<div><Widget ref:widget foo='{{foo}}'/></div>
<script>
import Widget from './Widget.html';
export default {
components: { Widget },
data () {
return { foo: 42 }
}
};
</script>
Loading…
Cancel
Save