Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

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

0 votes
25 views
added Jun 26, 2018 in Vue by FeruzRahim Lance Corporal (780 points)
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 by LC Marshal Captain (25,420 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 by LC Marshal Captain (25,420 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.
...