screen_rotation
Copied to Clipboard
<html> <head> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> </head> <body> <div id="app"> <h1>Vue Js check if all the arrays inside an array of arrays are empty</h1> <ul> <li v-for="(array, index) in arrayOfArrays" :key="index"> {{ array }} </li> </ul> <p v-if="allArraysEmpty" style="color:red">All arrays are empty!</p> <p v-else>There are non-empty arrays.</p> </div> <script type="module"> const app = new Vue({ el: "#app", data() { return { arrayOfArrays: [[], [], []], }; }, computed: { allArraysEmpty() { return this.arrayOfArrays.every(arr => arr.length === 0); }, } }); </script> <style scoped> #app { font-family: Arial, sans-serif; background-color: #f0f0f0; padding: 20px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); } h1 { font-size: 24px; margin-bottom: 10px; } ul { list-style: none; margin: 0; padding: 0; } li { font-size: 18px; margin-bottom: 5px; } p { font-size: 16px; margin-top: 10px; } </style> </body> </html>