Vue.js Get Array Length
home
Run
screen_rotation
fullscreen
cloud_download
<!DOCTYPE html> <html> <head> <script src="http://cdn.jsdelivr.net/vue/1.0.16/vue.js"></script> </head> <body> <ul id="exampleApp"> <li v-if="items.length">Object Length = {{items.length}}</li> <li v-for="item in items"> {{ item.fruit }} </li> </ul> <script> var exampleApp = new Vue({ el: '#exampleApp', data: { items: [ { fruit: 'Mango' }, { fruit: 'Apple' }, { fruit: 'Banana' } ] } }); </script> </body> </html>
<!DOCTYPE html> <html> <head> <script src="http://cdn.jsdelivr.net/vue/1.0.16/vue.js"></script> </head> <body> <ul id="exampleApp"> <li v-if="items.length">Object Length = {{items.length}}</li> <li v-for="item in items"> {{ item.fruit }} </li> </ul> <script> var exampleApp = new Vue({ el: '#exampleApp', data: { items: [ { fruit: 'Mango' }, { fruit: 'Apple' }, { fruit: 'Banana' } ] } }); </script> </body> </html>
Copyrights@tutorialsplane.com