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 unshift Method</h2> <p>Add new items starting of the array in Vue js</p> <button @click="addFun">click me</button> <P>Object Property:</P> <p v-for="object in demoObject">{{object}}</p> <p>Total Property: {{result}}</p> </div> <script type="module"> import { createApp } from 'vue' createApp({ data() { return{ demoObject:[{ s_no:1, title:'Sarkari Naurkri Exams' }, { s_no:2, title:'Font Awesome Icons' }, { s_no:3, title:'Schools Geek' }, { s_no:4, title:'Tutorials Plane' } ], result:'' } }, methods:{ addFun(){ this.result = this.demoObject.unshift({s_no:0,title:'Digital Invitation Card'}); }, } }).mount('#app') </script> </body> </head> </html>