riku
2025-04-27 f46786f11c5c08ead7501a82e5a71430ad69b782
miniprogram_npm/tdesign-miniprogram/dropdown-menu/dropdown-menu.js
@@ -7,6 +7,7 @@
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 {
@@ -21,6 +22,7 @@
            menus: null,
            activeIdx: -1,
            bottom: 0,
            _arrowIcon: { name: props.arrowIcon.value },
        };
        this.relations = {
            '../dropdown-item/dropdown-item': {
@@ -30,6 +32,16 @@
        this.lifetimes = {
            ready() {
                this.getAllItems();
            },
        };
        this.observers = {
            arrowIcon(v) {
                this.setData({
                    _arrowIcon: calcIcon(v),
                });
            },
            activeIdx(v) {
                this.triggerEvent(v === -1 ? 'close' : 'open');
            },
        };
        this.methods = {
@@ -81,6 +93,7 @@
                const { index } = e.currentTarget.dataset;
                this.toggle(index);
            },
            noop() { },
        };
    }
};