Vue.Js Array Pop
home
Run
screen_rotation
fullscreen
cloud_download
<!DOCTYPE html> <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.13/vue.js"></script> </head> <body> <div id="app"> <p>item 1 = {{ item1 }}</p> <p>Result = {{result}}</p> <button @click="myFunction()">Click Me</button> </div> <script> new Vue({ el: '#app', data: { item1:[12, 10, 9, 5, 6, 4], result:'' }, methods:{ myFunction: function () { this.result = this.item1.pop(); } } }); </script> </body> </html>
<!DOCTYPE html> <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.13/vue.js"></script> </head> <body> <div id="app"> <p>item 1 = {{ item1 }}</p> <p>Result = {{result}}</p> <button @click="myFunction()">Click Me</button> </div> <script> new Vue({ el: '#app', data: { item1:[12, 10, 9, 5, 6, 4], result:'' }, methods:{ myFunction: function () { this.result = this.item1.pop(); } } }); </script> </body> </html>
Copyrights@tutorialsplane.com