[Vuejs]-Vue Js render dynamic information in template

0👍

Try :

vm = new Vue({
  el: "#app",
  data() {
    return {
      message: ''
    }
  }
});

$('.lead-details-btn').on('click', function() {
  console.log( $(this).attr('id'))
  vm.message = $(this).attr('id');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.2.5/vue.js"></script>

<div id="app">
  {{ message }}
  <button id="btn-1" class="lead-details-btn">btn-1</button>
  <button id="btn-2" class="lead-details-btn">btn-2</button>
  <button id="btn-3" class="lead-details-btn">btn-3</button>
</div>

Leave a comment