[Vuejs]-Update properties of component in Vue.js

0👍

You need to assign the attribute value of Size by the javascript method setAttribute . Example : this.$refs.modal.setAttribute('size', 'lg')

There is a working demo below:

new Vue({
  el: '#app',
  methods: {
    showdetails() {
      console.log(this.$refs.modal.getAttribute('size'));
      this.$refs.modal.setAttribute('size', 'lg')
    }

  }
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.15/vue.js"></script>

<div id='app'>
  <button size="md" @click="showdetails" ref="modal">Click</button>
</div>

Leave a comment