Computer scienceFrontendVue.jsVue 3 SyntaxVue Instance

Data and Methods

Error

Report a typo

What's wrong with this code?

<script>
export default {
  data() {
    return {
      counter: 0
    }
  },
  methods: {
    increment() {
      counter +=1
    },
    decrement() {
      counter -=1
    }
  }
} 
</script>

<template>
  <div>{{ counter }}</div>
  <button @click="increment">Increment</button>
  <button @click="decrement">Decrement</button>
</template>
Select one option from the list

Create a free account to access the full topic