জয়েন লগইন

ভিইউই keypress

🌈ভিইউই keypress কি?

📋ভিইউই keypress হলো কী পেস করলে অবহিত করার পদ্ধতি।

⚒️ভিইউই keypress কী পেস করলে অবহিত করতে ব্যবহৃত হয়।

ভিইউই keypress কী পেস করলে অবহিত করার উদাহরণ।

vue
<!DOCTYPE html>
<html>
<body>

<div id="app">

<input
  @keypress="keyPress"
  placeholder="press a key">

<p>{{ message }}</p>

</div>

<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
Vue.createApp({
  data() {
    return {
      message: ""
    };
  },
  methods: {
    keyPress(event) {
      this.message = event.key;
    }
  }
}).mount("#app");
</script>

</body>
</html>