screen_rotation
Copied to Clipboard
<html> <head> <script type="importmap"> { "imports": { "vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.js" } } </script> <body> <div id="app"> <h2>Vue js splice Method</h2> <p>At index 3, add 1 items:</p> <button @click="addFun">Add </button> <button @click="delFun">Delete</button> <p>{{demoArray}}</p> </div> <script type="module"> import { createApp } from 'vue' createApp({ data() { return{ demoArray : ['Vue','React','Angular','Node','Php'] } }, methods:{ addFun(){ this.demoArray.splice(3,0,'SQL'); }, delFun(){ this.demoArray.splice(3,1) } } }).mount('#app') </script> </body> </head> </html>