Created
November 8, 2019 06:26
-
-
Save jessijean/c59e9d06bebe206d4a69b65f9f825d74 to your computer and use it in GitHub Desktop.
Vue.js Check Data Array Length for V-if
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Check Data Object Array Length & Hide When Empty</title> | |
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> | |
</head> | |
<body> | |
<ul id="app"> | |
<li v-if="!items.length">No item found</li> | |
<li v-for="item in items"> | |
</li> | |
</ul> | |
</body> | |
<script type="text/javascript"> | |
var app = new Vue({ | |
el: '#app', | |
data: { | |
items: [] | |
} | |
}); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment