fix bindings in ssr

pull/1367/head
Rich Harris 7 years ago
parent c06bfdbe35
commit a641019ab9

@ -25,11 +25,11 @@ export default function visitAwaitBlock(
visit(generator, childBlock, child);
});
generator.append('`; return `');
generator.append('`; return function(ctx) { return `');
node.then.children.forEach((child: Node) => {
visit(generator, childBlock, child);
});
generator.append(`\`;}(${snippet})) }`);
generator.append(`\`;}(Object.assign({}, ctx, { ${node.value}: __value }));}(${snippet})) }`);
}

@ -22,15 +22,12 @@ export default function visitComponent(
}
const bindingProps = node.bindings.map(binding => {
const { name } = getObject(binding.value);
const tail = binding.value.type === 'MemberExpression'
? getTailSnippet(binding.value)
const { name } = getObject(binding.value.node);
const tail = binding.value.node.type === 'MemberExpression'
? getTailSnippet(binding.value.node)
: '';
const keypath = block.contexts.has(name)
? `${name}${tail}`
: `ctx.${name}${tail}`;
return `${binding.name}: ${keypath}`;
return `${binding.name}: ctx.${name}${tail}`;
});
function getAttributeValue(attribute) {

Loading…
Cancel
Save