During the implementation of Vue.js with sematic-ui,
I have the following Jquery to open the modal:
$('.ui.modal').modal('show');
How to do this integration in Vue?
During the implementation of Vue.js with sematic-ui,
I have the following Jquery to open the modal:
$('.ui.modal').modal('show');
How to do this integration in Vue?
With v-el
it is possible to "tag" the html elements to be used within components.
You can also use custom policies to do these manipulations.
<span v-el:msg>hello</span>
<span v-el:other-msg>world</span>
this.$els.msg.textContent // -> "hello"
this.$els.otherMsg.textContent // -> "world"
References:
When doing jQuery include via script tag the jQuery object will be automatically attached to the window object, and can then be used normally within a Vue component. Just take a reference to the markup of the modal using v-el.
Ex:
<div class="modal fade" tabindex="-1" role="dialog" v-el:modal>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
And in your component:
{
methods: {
metodoAssociadoAoCliqueUsuario () {
jQuery(this.$els.modal).modal('show')
}
}
}