From d1dc4a75bae3f9bf7cec9a0ede9c4c2a90f7372a Mon Sep 17 00:00:00 2001 From: hymbz Date: Sun, 11 Aug 2024 23:55:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20:bug:=20=E4=BF=AE=E5=A4=8D=E9=9D=9E?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83=E4=B8=8B=E7=9A=84=20useSty?= =?UTF-8?q?leSheet=20=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Fab/index.tsx | 3 +-- src/components/IconButton/index.tsx | 10 +++++--- .../Manga/components/ComicImgFlow.tsx | 3 +-- src/components/Manga/components/Scrollbar.tsx | 9 ++----- src/components/Manga/hooks/useCssVar.ts | 4 ++- src/components/Manga/hooks/useStyle.ts | 10 ++++++++ src/components/Manga/index.tsx | 14 +++++------ src/components/Toast/Toaster.tsx | 2 +- src/helper/useStyle.ts | 25 ++++++------------- 9 files changed, 38 insertions(+), 42 deletions(-) create mode 100644 src/components/Manga/hooks/useStyle.ts diff --git a/src/components/Fab/index.tsx b/src/components/Fab/index.tsx index a764cb36..6c6eb5a8 100644 --- a/src/components/Fab/index.tsx +++ b/src/components/Fab/index.tsx @@ -40,8 +40,6 @@ export interface FabProps { * Fab 按钮 */ export const Fab: Component = (_props) => { - onMount(() => useStyle(style)); - const props = mergeProps( { progress: 0, initialShow: true, autoTrans: false }, _props, @@ -72,6 +70,7 @@ export const Fab: Component = (_props) => { return (
useStyle(style, ref)} class={classes.fabRoot} data-show={props.show ?? show()} data-trans={props.autoTrans} diff --git a/src/components/IconButton/index.tsx b/src/components/IconButton/index.tsx index ddd6de78..7320e750 100644 --- a/src/components/IconButton/index.tsx +++ b/src/components/IconButton/index.tsx @@ -1,4 +1,4 @@ -import { type Component, type JSX, mergeProps, onMount } from 'solid-js'; +import { type Component, type JSX, mergeProps } from 'solid-js'; import { useStyle } from 'helper'; import classes, { css as style } from './index.module.css'; @@ -24,8 +24,6 @@ interface IconButtonProps { /** 图标按钮 */ export const IconButton: Component = (_props) => { - onMount(() => useStyle(style)); - const props = mergeProps({ placement: 'right' }, _props); let buttonRef: HTMLButtonElement; const handleClick: EventHandler['on:click'] = (e) => { @@ -35,7 +33,11 @@ export const IconButton: Component = (_props) => { }; return ( -
+
useStyle(style, ref)} + class={classes.iconButtonItem} + data-show={props.showTip} + >