[Vuejs]-How to add custom html attributes in vue

-1👍

Try binding a prop with the attribute. Using watch to hook the prop.

<div id="g_id_onload"
     :data-client-id="data_client_id">
</div>

<script>
new Vue({
  el: '#app',
  props: ['data_client_id'],
  data: {},
  watch: { 
     data_client_id: function(newVal, oldVal) { // watch it
          console.log('Prop changed: ', newVal, ' | was: ', oldVal)
     },
  }
});
</script>

Leave a comment