M
M
marsdenden2019-12-20 13:36:27
Video
marsdenden, 2019-12-20 13:36:27

How to send $emit to main application from vue.js plugin?

I made a plugin, it registers like this

let API = {
    install(Vue, options) {
        API.$AuthInfo = {user: {username: ''}}
        Vue.prototype.$API = API
    },
    callApi(params){
      // some actions
    }

as a result, you can use it in vue as this.$API.callApi(params)
But I can’t find how to send it from the callApi plugin method like this.$root.$emit, since there is no root vue instance in the plugin.
How to reach the vue instance from the plugin?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
A person from Kazakhstan, 2019-02-11
@Dim2017

Is it a charger??
Open the NetWork Chrome tab and do as in the screenshot
, then after that press the Play button and a link to the video will appear below, hover and RMB: open in new tab and that's it

A
Alexey Yarkov, 2019-12-20
@marsdenden

Maybe the event bus will be the output ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question