From 34418ae2dd61247be0e1f44bd8b82f9fc89b31a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Tue, 16 Apr 2019 11:47:27 +0800 Subject: [PATCH] bug: fix autoHeight infinite loop --- .dockerignore | 35 ----- .firebaserc | 5 - .gitpod.yml | 6 - Analysis/src/components/Charts/autoHeight.tsx | 13 +- Analysis/src/components/IntroduceRow.tsx | 122 +++++++++--------- typings.d.ts | 3 + 6 files changed, 69 insertions(+), 115 deletions(-) delete mode 100644 .dockerignore delete mode 100644 .firebaserc delete mode 100644 .gitpod.yml diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 8e90ca6d..00000000 --- a/.dockerignore +++ /dev/null @@ -1,35 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -**/node_modules -/src/utils/request-temp.js - -# production -/.vscode - -# misc -.DS_Store -npm-debug.log* -yarn-error.log - -/coverage -.idea -yarn.lock -package-lock.json -*bak -.vscode - -# visual studio code -.history -*.log - -functions/mock -.temp/** - -# umi -.umi -.umi-production - -# screenshot -screenshot -.firebase \ No newline at end of file diff --git a/.firebaserc b/.firebaserc deleted file mode 100644 index e3a9a50c..00000000 --- a/.firebaserc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "projects": { - "default": "antd-pro" - } -} diff --git a/.gitpod.yml b/.gitpod.yml deleted file mode 100644 index ba727aa8..00000000 --- a/.gitpod.yml +++ /dev/null @@ -1,6 +0,0 @@ -ports: -- port: 8000 - onOpen: open-preview -tasks: -- init: npm install - command: npm start diff --git a/Analysis/src/components/Charts/autoHeight.tsx b/Analysis/src/components/Charts/autoHeight.tsx index 310dac7c..aa255000 100644 --- a/Analysis/src/components/Charts/autoHeight.tsx +++ b/Analysis/src/components/Charts/autoHeight.tsx @@ -1,4 +1,3 @@ -/* eslint eqeqeq: 0 */ import React from 'react'; export type IReactComponent

= @@ -7,6 +6,7 @@ export type IReactComponent

= | React.ClassicComponentClass

; function computeHeight(node: HTMLDivElement) { + node.style.height = '100%'; const totalHeight = parseInt(getComputedStyle(node).height + '', 10); const padding = parseInt(getComputedStyle(node).paddingTop + '', 10) + @@ -22,14 +22,9 @@ function getAutoHeight(n: HTMLDivElement) { let node = n; let height = computeHeight(node); - - while (!height) { - const parentNode = node.parentNode as HTMLDivElement; - if (parentNode) { - height = computeHeight(parentNode); - } else { - break; - } + const parentNode = node.parentNode as HTMLDivElement; + if (parentNode) { + height = computeHeight(parentNode); } return height; diff --git a/Analysis/src/components/IntroduceRow.tsx b/Analysis/src/components/IntroduceRow.tsx index 61a181f9..c939584d 100755 --- a/Analysis/src/components/IntroduceRow.tsx +++ b/Analysis/src/components/IntroduceRow.tsx @@ -59,66 +59,68 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: IVi - {/* - } - action={ - - } - > - - - } - total={numeral(8846).format('0,0')} - footer={ - - } - value={numeral(1234).format('0,0')} - /> - } - contentHeight={46} - > - - - */} - - {/* - } - action={ - - } - > - - - } - total={numeral(6560).format('0,0')} - footer={ - - } - value="60%" - /> - } - contentHeight={46} - > - - - */} + + } + action={ + + } + > + + + } + total={numeral(8846).format('0,0')} + footer={ + + } + value={numeral(1234).format('0,0')} + /> + } + contentHeight={46} + > + + + + + } + action={ + + } + > + + + } + total={numeral(6560).format('0,0')} + footer={ + + } + value="60%" + /> + } + contentHeight={46} + > + + +