From cc62782f560a97dd5a630730d0d80e9fd8926b8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E6=97=A0=E6=95=8C=E6=95=B0=E7=A0=81?= =?UTF-8?q?=E6=9A=B4=E9=BE=99=E6=88=98=E5=A3=AB?= <1845519693@qq.com> Date: Mon, 18 Nov 2024 22:39:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E8=AF=BE=E8=AF=84?= =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/main/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/main/index.tsx b/src/pages/main/index.tsx index db92f86..c7fda1f 100644 --- a/src/pages/main/index.tsx +++ b/src/pages/main/index.tsx @@ -46,6 +46,7 @@ export default function Index() { const handleChangeType = (type) => { // eslint-disable-next-line @typescript-eslint/no-unsafe-argument dispatch.changeType(type); + void dispatch.refershComments(); }; useEffect(() => { From ddf4c18fe895b170441a37d1dfbc26f77fabe941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E6=97=A0=E6=95=8C=E6=95=B0=E7=A0=81?= =?UTF-8?q?=E6=9A=B4=E9=BE=99=E6=88=98=E5=A3=AB?= <1845519693@qq.com> Date: Tue, 19 Nov 2024 16:16:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E8=AF=BE=E8=AF=84?= =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/components/chart/index.tsx | 37 +++++++++++++++------------ src/pages/classInfo/index.tsx | 2 +- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/common/components/chart/index.tsx b/src/common/components/chart/index.tsx index f64f462..4e7d09f 100644 --- a/src/common/components/chart/index.tsx +++ b/src/common/components/chart/index.tsx @@ -64,21 +64,23 @@ const LineChart: React.FC = (props) => { }, []); const drawLineChart = () => { const query = Taro.createSelectorQuery(); - query - .select(`#${id ?? DEFAULT_CHART_ID}`) - .fields({ node: true, size: true }) - .exec((res) => { - const dpr = Taro.getSystemInfoSync().pixelRatio; - const canvas = res[0].node as CanvasInterface; - const { width, height } = canvas; - canvas.width = width * dpr; - canvas.height = height * dpr; - // 设置 canvas 组件的样式宽高 - setSize({ x: width ?? 200, y: height ?? 200 }); - const ctx = canvas.getContext('2d') as CanvasContext; - ctx.scale(dpr, dpr); - drawChart(ctx); - }); + setTimeout(() => { + query + .select(`#${id ?? DEFAULT_CHART_ID}`) + .fields({ node: true, size: true }) + .exec((res) => { + const dpr = Taro.getSystemInfoSync().pixelRatio; + const canvas = res[0].node as CanvasInterface; + const { width, height } = canvas; + canvas.width = width * dpr; + canvas.height = height * dpr; + // 设置 canvas 组件的样式宽高 + setSize({ x: width ?? 200, y: height ?? 200 }); + const ctx = canvas.getContext('2d') as CanvasContext; + ctx.scale(dpr, dpr); + drawChart(ctx); + }); + }, 200); }; const drawChart = (ctx: CanvasContext) => { @@ -178,14 +180,15 @@ const LineChart: React.FC = (props) => { return ( ))} - +