Vue JS Get Array Length Or Object Length Example

Vue JS Get Array Length Or Object Length Example


tutorials - 5 undefined, 2020

Vue JS Get Array Length Or Object Length Example

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...

Our Sponsors

NodeJS Experts
React Experts
PHP Experts
AngularJS Experts
Aws Experts
Firebase Experts

Top Applications in TutorialStuff

Top Experts In TutorialStuff

Trending On TutorialStuff