Vue.JS check if Object or Array is empty
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">No item found</li> <li v-for="item in items"> <!--do whatever you want--> </li> </ul> <script> var exampleApp = new Vue({ el: '#exampleApp', data: { items: [] } }); </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">No item found</li> <li v-for="item in items"> <!--do whatever you want--> </li> </ul> <script> var exampleApp = new Vue({ el: '#exampleApp', data: { items: [] } }); </script> </body> </html>
Copyrights@tutorialsplane.com