LoginSignup
0
0

More than 1 year has passed since last update.

Nuxt3 (Vue) – ボタンをクリックするカウンタの例

Posted at

とりあえず動いている
カウントアップする時には count ではなく count.value をインクリメントする必要がありそうだが、まだ良くわかっていない

コード例

<template>
  <div>
    <p>{{ count }}</p>
  </div>
  <button @click="countUp">Count</button>
</template>

<script setup lang="ts">
let count = ref(0);
const countUp = (): number => {
  return count.value++;
};
</script>


動作例

image
image

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0