mirror of
https://github.com/sveltejs/svelte.git
synced 2024-11-30 00:46:29 +01:00
in each-else, use mount/intro according to that branch's contents (#1586)
Fixes # 1559
This commit is contained in:
parent
e66d9ffae7
commit
26dfb9afa7
@ -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 @@
|
||||
Foo
|
@ -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…
Reference in New Issue
Block a user