-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Description
Could v-if exclude empty arrays ?
Or is there another way to do it ?
For instance, imagine the given Vue :
<section id='container'>
<div id='list-wrapper' v-if='list << I would here mean : "if list is not empty" >>'>
<h5>List of things</h5>
<ul>
<li v-repeat='item: list'>{{ item }}</li>
</ul>
</div>
</section>
new Vue({
el: '#container',
data: function () {
return {
list: []
}
},
events: {
'list:add': function (item) {
this.list.push(item);
}
}
});
When list
is an empty array, I would prefer the content of <div id='list-wrapper'></div>
not to be included in the DOM.
I would prefer it to be included only when I push some items in my list
array.
Metadata
Metadata
Assignees
Labels
No labels