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

Fixes # 1559
pull/1588/head
Conduitry 7 years ago committed by GitHub
parent e66d9ffae7
commit 26dfb9afa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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