riku
2025-04-27 f46786f11c5c08ead7501a82e5a71430ad69b782
miniprogram_npm/tdesign-miniprogram/cell/cell.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}-cell`;
let Cell = class Cell extends SuperComponent {
@@ -21,6 +22,7 @@
            `${prefix}-class-image`,
            `${prefix}-class-left`,
            `${prefix}-class-left-icon`,
            `${prefix}-class-center`,
            `${prefix}-class-right`,
            `${prefix}-class-right-icon`,
        ];
@@ -38,6 +40,24 @@
            classPrefix: name,
            isLastChild: false,
        };
        this.observers = {
            leftIcon(v) {
                this.setIcon('_leftIcon', v, '');
            },
            rightIcon(v) {
                this.setIcon('_rightIcon', v, '');
            },
            arrow(v) {
                this.setIcon('_arrow', v, 'chevron-right');
            },
        };
    }
    setIcon(name, value, defaultValue) {
        if (!value)
            return;
        this.setData({
            [name]: calcIcon(value, defaultValue),
        });
    }
    onClick(e) {
        this.triggerEvent('click', e.detail);