vue-bus.js 445 B

1234567891011121314151617
  1. const install = function (Vue) {
  2. const Bus= new Vue({
  3. methods : {
  4. emit (event, ... args) {
  5. this.$emit (event, ... args);
  6. },
  7. on (event, callback) {
  8. this.$on (event, callback);
  9. },
  10. off (event, callback) {
  11. this . $off(event, callback);
  12. }
  13. }
  14. })
  15. Vue.prototype.$bus = Bus;
  16. }
  17. export default install