handle component directives at positions other than end (fixes #221)

pull/226/head
Rich-Harris 9 years ago
parent 620b9ae5e8
commit 11dc7dc380

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