Blame view

node_modules/vue-baidu-map/components/base/mixins/abstract.js 471 Bytes
290144e9   易尊强   第一次
1
2
3
4
5
6
7
8
9
10
11
12
13
  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)