server-render bindings

pull/1238/head
Rich Harris 8 years ago
parent 0ac77019d0
commit 27cdfb9a50

@ -35,8 +35,7 @@ export default function visitElement(
}
node.attributes.forEach((attribute: Node) => {
if (attribute.type !== 'Attribute') return;
if (attribute.type === 'Attribute') {
if (attribute.name === 'value' && node.name === 'textarea') {
textareaContents = stringifyAttributeValue(block, attribute.value);
} else if (attribute.value === true) {
@ -52,6 +51,10 @@ export default function visitElement(
} else {
openingTag += ` ${attribute.name}="${stringifyAttributeValue(block, attribute.value)}"`;
}
} else if (attribute.type === 'Binding') {
block.contextualise(attribute.value); // TODO gah this is hacky, contextualise everything upfront
openingTag += '${' + attribute.metadata.snippet + ' === false ? "" : " ' + attribute.name + '" + (' + attribute.metadata.snippet + ' === true ? "" : "=" + JSON.stringify(' + attribute.metadata.snippet + '))}';
}
});
if (node._cssRefAttribute) {

@ -0,0 +1,9 @@
<input bind:value=foo >
<script>
export default {
data() {
return { foo: 'bar' };
}
};
</script>
Loading…
Cancel
Save