<!-- 
Vue.js(単体)入門-クリックイベント
-->

<!-- Use preprocessors via the lang attribute! e.g. <template lang="pug"> -->
<template>
  <div id="app1">
    <p>{{ count }}回クリックしました</p>
    <button v-on:click="increment">カウントを増やす</button>
  </div> 
</template>

<script>
export default {
  data() {
    return {
      count: 0
    };
  },
  methods: {
    increment: function() {
      this.count += 1
    }
  }
};
</script>

<!-- Use preprocessors via the lang attribute! e.g. <style lang="scss"> -->
<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}

</style>

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.