-
-
Save Habil99/2e4c7b4e4d80a193fdc444e0e053c712 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="user"> | |
<input type="text" placeholder="Name" v-model="name" @keypress="setTitle"> | |
<h2>Username: {{ title }}</h2> | |
</div> | |
// Vue code You have to code this on javascript file | |
const user = { | |
data() { | |
return { | |
name: "", | |
title: "" | |
} | |
}, | |
methods: { | |
setTitle(e) { | |
if (e.keyCode == 13) { | |
this.title = this.name | |
} | |
} | |
} | |
} | |
Vue.createApp(user).mount("#user"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment