bk-magic-vue
Version:
基于蓝鲸 Magicbox 和 Vue 的前端组件库
30 lines (25 loc) • 891 B
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.library = {}));
}(this, function (exports) { 'use strict';
var emitter = {
methods: {
dispatch: function dispatch(componentName, eventName, params) {
var parent = this.$parent || this.$root;
var name = parent.$options.name;
while (parent && (!name || name !== componentName)) {
parent = parent.$parent;
if (parent) {
name = parent.$options.name;
}
}
if (parent) {
parent.$emit.apply(parent, [eventName].concat(params));
}
}
}
};
exports.default = emitter;
Object.defineProperty(exports, '__esModule', { value: true });
}));