I have created a method that is triggered with a button on:click
event, but it doesn't seem to work.
There is the code:
<template>
<div class=button>
<button v-on:click="refreshTemperature" type="button" > Search </button>
<p> Temperature : {{ temp }} </p>
</div>
</template>
export default {
name: 'Meteo',
data() {
return {
temp: Math.floor(Math.random() * (30 - 10) ) + 10,
},
methods: {
refreshTemperature : () => {
this.temp ++;
}
}
When I click the button nothing happens. What am I missing?