[Vuejs]-How to show modal on component/page created/load in Vue.js

2👍

Use in mounted without $(document).ready(function(){}):

mounted() {
  this.openModal();
},

2👍

Don’t mix jQuery and Vue. Vue works with Virtual DOM and you should update, show, hide elements according to Vue documentation, no work around with jQuery. This is article about creating modal in Vue, I hope it helps
https://alligator.io/vuejs/vue-modal-component/

👤MissK

1👍

mounted() {
    this.showModal()
},

methods: {
    showModal() {
     this.$modal.show("model-name")
    },
}

this can be used for opening model in vuejs

Leave a comment