New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v-if with array #677
Comments
So you just need to think of a javascript expression that will evaluate to false if the array is empty... |
Like checking, at any mutation of the graph, and when the array become empty, set it to false ? |
No you don't have to check for array mutation, Vue will do that for you. |
So how could I do it ? |
<div id='list-wrapper' v-if="list.length > 0">
</div> And here's a fiddle: http://jsfiddle.net/4t6hjwev/1/ |
Oh, okay, I just didn't realize I could access the array properties inside the directive. |
here item is an array and detailRowId is contains dynamic data. But i m getting ReferenceError: detailRowId is not defined How its possible to handle this kind of access? |
same here |
Sadly |
I'm sorry to hear that. But I have a question: What exactly are we supposed to do with that statement, posted to a two year old, closed issue with zero information about the exact problem? |
[Vue warn]: Error in render: "TypeError: Cannot read property 'length' of undefined" |
|
it's pretty clumsy, what if you want v-if when the array is empty...
|
Could v-if exclude empty arrays ?
Or is there another way to do it ?
For instance, imagine the given Vue :
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.The text was updated successfully, but these errors were encountered: