Vue event handling - @click or v-on:click

0 votes
470 views
added Jun 26, 2018 in Vue by anonymous
edited Jul 13, 2018 by LC Marshal
<button class="btn btn-primary btn-block" @click="$router.push('fund/1')">Fund</button>

2 Responses

0 votes
responded Oct 25, 2019 by LC Marshal Captain (25,790 points)
<SearchFilters :key="resetKey" class="mb-3 search-container list-search" />
<button v-on:click="forceRerender">reset {{resetKey}}</button>

<script>
data() {
    return {
      resetKey: 0
    }
}
}
methods: {
  forceRerender() {
    this.componentKey += 1;  
  },
  onSuccess(){
    this.fetchCount = true;
    this.fetchList();
  },
  getLabel(collection,check){
    let label = ''
    var result = collection.filter(function( obj ) {
      return obj.value == check;
    });
    if(result.length >0){
      label = result[0].text;
    }
    return label;
  },
}
</script>

 

0 votes
responded Oct 25, 2019 by LC Marshal Captain (25,790 points)
Methods in Inline Handlers

<div id="example-3">
  <button v-on:click="say('hi')">Say hi</button>
  <button v-on:click="say('what')">Say what</button>
</div>

<script>
new Vue({
  el: '#example-3',
  methods: {
    say: function (message) {
      alert(message)
    }
  }
})
</script>

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...