vue-baidu-map-3x
Version:
vue-baidu-map的vue3版本(支持v2.0、v3.0和webGl api)。Baidu Map Component for Vue 3.0 (support v2.0 、 v3.0 and webGl api)
14 lines (12 loc) • 484 B
JavaScript
class Mixin {
constructor ({component, props, events, extraProps, exceptProps}) {
this.render = function (h) {
return h(component, {
props: props.reduce((obj, key) => Object.assign(obj, {[key]: this[key]}), {}),
on: events.reduce((obj, key) => Object.assign(obj, {[key]: this.transmitEvent}), {})
})
}
this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))]
}
}
export default prop => new Mixin(prop)