screen_rotation
Copied to Clipboard
<html> <head> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> </head> <body> <div id="app"> <h3>Vue Js Add arrays into an array</h3> <ul> <li v-for="(item, index) in myArray" :key="index"> {{ item }} </li> </ul> <button @click="addArray">Add Array</button> </div> <script type="module"> const app = new Vue({ el: "#app", data() { return { myArray: [[1, 2], [3, 4]], }; }, methods: { addArray() { this.myArray.push([5, 6]); }, }, }); </script> <style scoped> #app { max-width: 600px; margin: 0 auto; padding: 20px; font-family: Arial, sans-serif; background-color: #f2f2f2; border: 1px solid #ccc; } h3 { margin-top: 0; } ul { list-style: none; padding: 0; margin: 0; } li { margin-bottom: 10px; } button { background-color: #4CAF50; border: none; color: white; padding: 10px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin-top: 10px; cursor: pointer; border-radius: 5px; } button:hover { background-color: #3e8e41; } </style> </body> </html>