SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let eventHub = new Vue()
  2.  
  3. // Listening
  4. eventHub.$on('eventName', (data) => {
  5.     console.log('Trigger this event and receive ' + data)
  6. })
  7.  
  8. // Broadcasting
  9. eventHub.$emit('eventName', data)
  10.  
  11. // Not listen any more
  12. eventHub.$off('eventName')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top