v-for add v-else
What problem does this feature solve?
Want to add v-else
corresponding to v-for
render the contents of v-for
when the length of the object traversed by v-else
is empty
What does the proposed API look like?
like svelte:
{#each todos || [] as todo}
<p>{todo.text}</p>
{:else}
<p>No tasks today!</p>
{/each}
to vue
<p v-for="todo in todos">{todo.text}</p>
<p v-else>No tasks today!</p>
There's an open RFC for this:
Earlier discussions: