v-on.uvue 626 字节
Newer Older
H
hdx 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
<template>
  <view class="page">
    <view class="split-title">v-on</view>
    <view class="button view-click" @click="onClick">click</view>
    <view class="button view-v-on-click" v-on:click="onClick">v-on:click</view>
    <view>
      <text class="count">{{count}}</text>
    </view>
  </view>
</template>

<script lang="ts">
  export default {
    data() {
      return {
        count: 0
      }
    },
    methods: {
      onClick() {
        this.count++
        console.log('onClick')
      }
    }
  }
</script>

<style>
  .button {
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ccc;
  }
</style>