i'm currently learning vuejs by making a login app however i can access the value of input it gave me undefined , i'm clearly doing something wrong here but i cant find where i'm mistaken here is my code , can u point me to the right direction here is the code
var app = new Vue({
el: '#app',
data() {
return {
username: "",
password: ""
}
},
methods: {
login() {
console.log(this.username)
},
}
})
<div id="app">
<div class="main">
<div class="left">
<h1>Login</h1>
<p><i>To your Account</i></p>
<form @submit.prevent="login">
<input type="text" name="username" v-model="username" placeholder="Username" />
<input type="password" name="password" v-model="password" placeholder="Password" />
<input type="submit" value="LOG IN">
</form>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.0"></script>
thank you in advance