Vue JS Get Array Length Or Object Length Example
In this post we will give you information about Vue JS Get Array Length Or Object Length Example. Hear we will give you detail about Vue JS Get Array Length Or Object Length ExampleAnd how to use it also give you demo for it if it is necessary.
If you don’t know how to get array length in vue js then i will give example for vue js get object length. if you worked with javascript jquery then you know you can get array length by variable.length so same way you can get array length or object length in vue js application.
I give you bellow very simple example so you can understand how to getting array length or object length in vue js code.
Example:
<!DOCTYPE html>
<html>
<head>
<title>Vue JS Get Array Length Or Object Length Example - ItSolutionStuff.com</title>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>
<body>
<div id="app">
<ul id="exampleApp">
<li v-if="myArray.length">Object Length = {{ myArray.length }}</li>
<li v-for="value in myArray">
{{ value.category }}
</li>
</ul>
</div>
<script type="text/javascript">
var app = new Vue({
el: '#app',
data: {
myArray: [
{ category: 'Laravel' },
{ category: 'PHP' },
{ category: 'Codeigniter' }
]
}
})
</script>
</body>
</html>
Output:
Object Length = 3
Laravel
PHP
Codeigniter
I hope it can help you…
Hope this code and post will helped you for implement Vue JS Get Array Length Or Object Length Example. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs