jiku-ui
Version:
A Component Library for Vue.js.
24 lines (19 loc) • 617 B
JavaScript
;
exports.__esModule = true;
exports.inherit = inherit;
var inheritKey = ['ref', 'style', 'class', 'attrs', 'nativeOn', 'directives', 'staticClass', 'staticStyle'];
var mapInheritKey = { nativeOn: 'on' };
// inherit partial context, map nativeOn to on
function inherit(context, inheritListeners) {
var result = inheritKey.reduce(function (obj, key) {
if (context.data[key]) {
obj[mapInheritKey[key] || key] = context.data[key];
}
return obj;
}, {});
if (inheritListeners) {
result.on = result.on || {};
Object.assign(result.on, context.data.on);
}
return result;
}