1234567891011121314151617181920212223242526272829303132333435 |
- class ContextMenuItem {
- constructor(name, text, action, menuDom) {
- this.name = name;
- this.text = text;
- this.action = action;
- this.menuDom = menuDom;
- }
- render() {
- this.dom = DOM.create({ tag: DOM.Tags.Div, cls: 'context-menu-item', innerHTML: this.getText(), attr: { 'data-context-menu-item-name': this.getName() } }, this.menuDom)
- .on(DOM.Events.Click, this.getAction());
- return this;
- }
- dispose() {
- this.getDom().un(DOM.Events.Click, this.getAction());
- return this;
- }
- getDom() {
- return this.dom;
- }
- getText() {
- return this.text;
- }
- getName() {
- return this.name;
- }
- getAction() {
- return this.action;
- }
- }
|