UNPKG

antd-mini

Version:

antd-mini 是支付宝小程序 UI 组件库,遵循 Ant Design 规范。

47 lines (46 loc) 1.74 kB
import { __assign, __spreadArray } from "tslib"; // @ts-nocheck import { Component, getValueFromProps, triggerEventValues, } from '../_util/simply'; import { ThoughtChainProps } from './props'; Component({ props: ThoughtChainProps, data: { foldStatusMap: {}, }, methods: { onContentTap: function (e) { triggerEventValues(this, 'contentTap', [e], e); }, onTitleTap: function (e) { var _a = getValueFromProps(this, [ 'collapsible', 'onExpand', ]), collapsible = _a[0], onExpand = _a[1]; if (!collapsible) return; // 受控模式 if (onExpand && (collapsible === null || collapsible === void 0 ? void 0 : collapsible.expandedKeys)) { var expandedKeys = collapsible.expandedKeys; var key = e.currentTarget.dataset.key; var isExpandNow = expandedKeys.includes(key); var newExpandedKeys = __spreadArray([], expandedKeys, true); if (isExpandNow) { newExpandedKeys.splice(newExpandedKeys.indexOf(key), 1); } else { newExpandedKeys.push(key); } triggerEventValues(this, 'expand', [newExpandedKeys, key]); } else { var key = e.currentTarget.dataset.key; var foldStatusMap = __assign({}, this.data.foldStatusMap); var isFold = foldStatusMap[key]; foldStatusMap[key] = !isFold; this.setData({ foldStatusMap: foldStatusMap, }); } }, }, });