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 Get Array value by Index </h2> <p>Enter Index Nuber: <input @input='myFunction' type="number" v-model="index"/></p> <p>Array value: {{results}}</p> </div> <script type="module"> import { createApp } from 'vue' createApp({ data() { return{ index:'', months:['January','February','March','April','May','June','July','August','September','October','November','December'], results:'' } }, methods:{ myFunction(){ this.results = this.months[this.index]; } } }).mount('#app') </script> </body> </head> </html>