| | |
| | | import { SuperComponent, wxComponent } from '../common/src/index'; |
| | | import config from '../common/config'; |
| | | import props from './props'; |
| | | import { calcIcon } from '../common/utils'; |
| | | const { prefix } = config; |
| | | const name = `${prefix}-dropdown-menu`; |
| | | let DropdownMenu = class DropdownMenu extends SuperComponent { |
| | |
| | | menus: null, |
| | | activeIdx: -1, |
| | | bottom: 0, |
| | | _arrowIcon: { name: props.arrowIcon.value }, |
| | | }; |
| | | this.relations = { |
| | | '../dropdown-item/dropdown-item': { |
| | |
| | | this.lifetimes = { |
| | | ready() { |
| | | this.getAllItems(); |
| | | }, |
| | | }; |
| | | this.observers = { |
| | | arrowIcon(v) { |
| | | this.setData({ |
| | | _arrowIcon: calcIcon(v), |
| | | }); |
| | | }, |
| | | activeIdx(v) { |
| | | this.triggerEvent(v === -1 ? 'close' : 'open'); |
| | | }, |
| | | }; |
| | | this.methods = { |
| | |
| | | const { index } = e.currentTarget.dataset; |
| | | this.toggle(index); |
| | | }, |
| | | noop() { }, |
| | | }; |
| | | } |
| | | }; |