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CAAC,UAAU,CAAC;QAC1C,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,MAAM;YAAE,OAAO,EAAE,CAAC,CAAC,gCAAgC;QACxD,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,MAAM,GAAG,EAAS,CAAC;QAC1C,MAAM,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,EAAE,GAAG,MAAa,CAAC;QACxE,IAAI,MAAM;YAAE,OAAO,UAAU,KAAK,OAAO,KAAK,IAAI,KAAK,EAAE,CAAC;QAC1D,OAAO,cAAc,KAAK,OAAO,KAAK,IAAI,KAAK,gBAAgB,KAAK,OAAO,KAAK,IAAI,KAAK,EAAE,CAAC;IAC9F,CAAC;IAED,OAAO,CAAC,CAAC;QACP,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC;QACzC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAED,QAAQ;QACN,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC;QAC1C,IAAI,GAAG,IAAI,QAAQ,EAAE;YACnB,IAAI,SAAS,CAAC,QAAe,CAAC,EAAE;gBAC9B,EAAE,CAAC,SAAS,CAAC,QAAe,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;aACzC;SACF;IACH,CAAC;CACF,CAAA;AAvFoB,QAAQ;IAD5B,WAAW,EAAE;GACO,QAAQ,CAuF5B;eAvFoB,QAAQ","file":"grid-item.js","sourcesContent":["import { SuperComponent, wxComponent, isObject } from '../common/src/index';\nimport config from '../common/config';\nimport props from './grid-item-props';\n\nconst { prefix } = config;\nconst name = `${prefix}-grid-item`;\nenum LinkTypes {\n 'redirect-to' = 'redirectTo',\n 'switch-tab' = 'switchTab',\n 'relaunch' = 'reLaunch',\n 'navigate-to' = 'navigateTo',\n}\n\n@wxComponent()\nexport default class GridItem extends SuperComponent {\n externalClasses = ['t-class', 't-class-image', 't-class-text', 't-class-description'];\n\n options = {\n multipleSlots: true,\n };\n\n relations = {\n './grid': {\n type: 'ancestor' as 'ancestor',\n linked(this: GridItem, target: WechatMiniprogram.Component.TrivialInstance) {\n this.parent = target;\n this.updateStyle();\n },\n },\n };\n\n properties = props;\n\n data = {\n classPrefix: name,\n gridItemStyle: '',\n gridItemWrapperStyle: '',\n gridItemContentStyle: '',\n align: 'center',\n layout: 'vertical',\n };\n\n updateStyle() {\n const { hover, align } = this.parent.properties;\n const gridItemStyles = [];\n const gridItemWrapperStyles = [];\n const gridItemContentStyles = [];\n const widthStyle = this.getWidthStyle();\n const paddingStyle = this.getPaddingStyle();\n const borderStyle = this.getBorderStyle();\n widthStyle && gridItemStyles.push(widthStyle);\n paddingStyle && gridItemWrapperStyles.push(paddingStyle);\n borderStyle && gridItemContentStyles.push(borderStyle);\n this.setData({\n gridItemStyle: gridItemStyles.join(';'),\n gridItemWrapperStyle: gridItemWrapperStyles.join(';'),\n gridItemContentStyle: gridItemContentStyles.join(';'),\n hover,\n layout: this.properties.layout,\n align: align,\n });\n }\n\n // 判断应该加在gridItem上的宽度\n getWidthStyle() {\n const { column = 4 } = this.parent.properties;\n return `width:${(1 / column) * 100}%`;\n }\n\n // 获取应该加在gridWrap上的padding\n getPaddingStyle() {\n const { gutter } = this.parent.properties;\n if (gutter) return `padding-left:${gutter}rpx;padding-top:${gutter}rpx`;\n return '';\n }\n\n // 判断border在grid-item-content上的css属性\n getBorderStyle() {\n const { gutter } = this.parent.properties;\n let { border } = this.parent.properties;\n if (!border) return ''; // 如果border的值没传或者是border的值为false\n if (!isObject(border)) border = {} as any;\n const { color = '#266FE8', width = 2, style = 'solid' } = border as any;\n if (gutter) return `border:${width}rpx ${style} ${color}`;\n return `border-top:${width}rpx ${style} ${color};border-left:${width}rpx ${style} ${color}`;\n }\n\n onClick(e) {\n const { item } = e.currentTarget.dataset;\n this.triggerEvent('click', item);\n this.jumpLink();\n }\n\n jumpLink() {\n const { url, jumpType } = this.properties;\n if (url && jumpType) {\n if (LinkTypes[jumpType as any]) {\n wx[LinkTypes[jumpType as any]]({ url });\n }\n }\n }\n}\n"]}