| | |
| | | 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 { |
| | |
| | | `${prefix}-class-image`, |
| | | `${prefix}-class-left`, |
| | | `${prefix}-class-left-icon`, |
| | | `${prefix}-class-center`, |
| | | `${prefix}-class-right`, |
| | | `${prefix}-class-right-icon`, |
| | | ]; |
| | |
| | | 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); |