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,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;gBACtD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;gBACzB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;gBAE5B,IAAI,GAAG,GAAG,CAAC,EAAE;oBACX,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;wBACrB,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;oBAC1B,CAAC,CAAC,CAAC;iBACJ;YACH,CAAC;YACD,WAAW,CAAC,KAAK;gBACf,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;YACrC,CAAC;YACD,iBAAiB,CAAC,KAAK;gBACrB,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;gBAEtD,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;oBACrB,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW,KAAK,KAAK,EAAE;wBACzC,IAAI,CAAC,WAAW,EAAE,CAAC;qBACpB;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;YACD;;eAEG;YACH,QAAQ;gBACN,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;gBAEjD,IAAI,CAAC,OAAO,CAAC;oBACX,gBAAgB,EAAE,SAAS;iBAC5B,CAAC,CAAC;gBACH,OAAO,SAAS,CAAC;YACnB,CAAC;SACF,CAAC;IACJ,CAAC;IAvDC;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;CAkDF,CAAA;AApFoB,MAAM;IAD1B,WAAW,EAAE;GACO,MAAM,CAoF1B;eApFoB,MAAM","file":"tab-bar.js","sourcesContent":["import { wxComponent, SuperComponent, RelationsOptions } from '../common/src/index';\nimport config from '../common/config';\nimport props from './props';\n\nconst { prefix } = config;\nconst classPrefix = `${prefix}-tab-bar`;\n\n@wxComponent()\nexport default class Tabbar extends SuperComponent {\n relations: RelationsOptions = {\n './tab-bar-item': {\n type: 'descendant',\n },\n };\n\n externalClasses = ['t-class'];\n\n data = {\n classPrefix,\n defaultNameIndex: -1,\n };\n\n properties = props;\n\n controlledProps = [\n {\n key: 'value',\n event: 'change',\n },\n ];\n\n observers = {\n value() {\n this.updateChildren();\n },\n };\n\n /**\n * value设置为多层级标签,需要展开\n */\n ready() {\n this.showChildren();\n }\n\n methods = {\n showChildren() {\n const items = this.getRelationNodes('./tab-bar-item');\n const len = items.length;\n const { value } = this.data;\n if (len > 0) {\n items.forEach((item) => {\n if (item.properties.currentName === value) {\n item.showSpread();\n }\n });\n }\n },\n updateChildren() {\n const items = this.getRelationNodes('./tab-bar-item');\n const len = items.length;\n const { value } = this.data;\n\n if (len > 0) {\n items.forEach((item) => {\n item.checkActive(value);\n });\n }\n },\n updateValue(value) {\n this._trigger('change', { value });\n },\n changeOtherSpread(value) {\n const items = this.getRelationNodes('./tab-bar-item');\n\n items.forEach((item) => {\n if (item.properties.currentName !== value) {\n item.closeSpread();\n }\n });\n },\n /**\n * 对于没有 name 的 item 生成一个 name\n */\n initName() {\n const nameIndex = this.data.defaultNameIndex + 1;\n\n this.setData({\n defaultNameIndex: nameIndex,\n });\n return nameIndex;\n },\n };\n}\n"]}