Forum

VUE3 - how to call ...
 
Notifications
Clear all

VUE3 - how to call component method from root app.js

1 Posty
1 Users
0 Reactions
421 Widok
0
Topic starter

example

1 Answer
0
Topic starter

1. It's not possible in easy way.  Read more here.

2. Use https://github.com/developit/mitt as separated event's lib.

 

Example code:

Emitter:

methods: {
	TestEmit() {
			this.emitter.emit('foo', { a: 'b' })
		}
	}	

Reciever:

   mounted() {
        this.emitter.on('foo', e => console.log('test ok!', e) 
    },

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: