You should avoid mixing dom events and related components, as these are different levels of abstraction.
In any case, if you still want to do this, I think you need to cache this.el inside an instance of the vue component or take it using a computed property such as
{ computed : { jqueryEl(){ return $(this.el) } } }
And then this.jqueryEl.trigger('ping')
jQuery custom events this.jqueryEl.trigger('ping')
.
Be sure to follow the rules for binding elements! For example, you can bind jQuery events dynamically (and also disable the destroy component!) As follows:
ready : function(){ jQuery('body').on('ping.namespace', '[data-jquery="ping"]', function(){ ... }) }, destroy : function(){ jQuery('body').off('ping.namespace') }
And don't forget to add the [data-jquery="ping"]
attribute to the element that you want to respond to the ping event.
We hope that this information will help you achieve the expected result.
source share