in each-else, use mount/intro according to that branch's contents #1559

pull/1586/head
Conduitry 7 years ago
parent 7774c6d92a
commit f116768a1e

@ -189,6 +189,7 @@ export default class EachBlock extends Node {
if (this.else) {
const each_block_else = compiler.getUniqueName(`${each}_else`);
const mountOrIntro = (this.else.block.hasIntroMethod || this.else.block.hasOutroMethod) ? 'i' : 'm';
block.builders.init.addLine(`var ${each_block_else} = null;`);

@ -5,6 +5,7 @@ import mapChildren from './shared/mapChildren';
export default class ElseBlock extends Node {
type: 'ElseBlock';
children: Node[];
block: Block;
constructor(compiler, parent, scope, info) {
super(compiler, parent, scope, info);

@ -0,0 +1,5 @@
export default {
nestedTransitions: true,
data: { items: [] },
html: `No items.`,
};

@ -0,0 +1,9 @@
{#each items as item}
<Widget {item}/>
{:else}
No items.
{/each}
<script>
export default { components: { Widget: './Widget.html' } };
</script>
Loading…
Cancel
Save