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AAO,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;iBACxC;gBAED,IAAI,CAAC,OAAO,CAAC;oBACX,SAAS;iBACV,CAAC,CAAC;YACL,CAAC;YACD,WAAW;gBACT,IAAI,CAAC,OAAO,CAAC;oBACX,QAAQ,EAAE,KAAK;iBAChB,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CAAA,CAAA;AAvFoB,UAAU;IAD9B,WAAW,EAAE;GACO,UAAU,CAuF9B;eAvFoB,UAAU","file":"tab-bar-item.js","sourcesContent":["import { wxComponent, SuperComponent, RelationsOptions } from '../common/src/index';\nimport config from '../common/config';\nimport props from './tab-bar-item-props';\n\nconst { prefix } = config;\nconst classPrefix = `${prefix}-tab-bar-item`;\n\n@wxComponent()\nexport default class TabbarItem extends SuperComponent {\n relations: RelationsOptions = {\n './tab-bar': {\n type: 'ancestor',\n linked(parent) {\n const [activeColor, color] = parent.data.color;\n this.setData({\n parent,\n color,\n activeColor,\n split: parent.data.split,\n currentName: this.properties.value ? this.properties.value : parent.initName(),\n });\n parent.updateChildren();\n },\n },\n };\n\n data = {\n prefix,\n classPrefix,\n isSpread: false,\n isChecked: false,\n parent: null,\n hasChildren: false,\n currentName: '',\n color: '',\n activeColor: '',\n split: true,\n };\n\n properties = props;\n\n observers = {\n subTabBar(value: Record<string, any>[]) {\n this.setData({\n hasChildren: value.length > 0,\n });\n },\n };\n\n methods = {\n showSpread() {\n this.setData({\n isSpread: true,\n });\n },\n toggle() {\n const { parent, currentName, hasChildren, isSpread } = this.data;\n\n if (hasChildren) {\n this.setData({\n isSpread: !isSpread,\n });\n }\n parent.updateValue(currentName);\n parent.changeOtherSpread(currentName);\n },\n selectChild(event) {\n const { parent, currentName } = this.data;\n const childName = event.target.dataset.name;\n\n if (!(Array.isArray(parent.value) && parent.value[1] === childName)) {\n parent.updateValue([currentName, childName]);\n }\n this.setData({\n isSpread: false,\n });\n },\n checkActive(value) {\n const { currentName, hasChildren } = this.data;\n const isChecked = currentName === value;\n\n if (hasChildren && Array.isArray(value)) {\n return value.indexOf(currentName) > -1;\n }\n\n this.setData({\n isChecked,\n });\n },\n closeSpread() {\n this.setData({\n isSpread: false,\n });\n },\n };\n}\n"]}
|