Переопределить статический геттер в ES6 - PullRequest
0 голосов
/ 22 апреля 2019

Предположим, у меня есть ESin-миксины, подобные этому:

// InputMixin.js
export const InputMixin = (base) => {
  return class Base extends base {

    static get _attribs() {
      return ['autofocus', 'autocomplete', 'form', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'name', 'type', 'value']
    }

    static get properties(){
      var props = {}

      for (let attribute of this._attribs) {
        props[attribute] = {
          attribute,
          reflect: false,
          converter: { fromAttribute: (value, type) => { } }
        }
      }
      return props
    }
  }
}

И класс, который использует миксины и хочет расширить статический геттер properties() ... как он на самом деле обращается к нему?

// InputButton.js
import { LitElement, html } from 'lit-element'
import { InputMixin } from './InputMixin.js'

class InputButton extends InputMixin(LitElement) {

  static get properties() {
    // How do I access the mixin's properties here?
    // I want to return those, and some extra ones
    debugger
  }

}
customElements.define('nn-input-button', InputButton)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...