Skip to content

Commit

Permalink
fix: 🐛 修复会在网页加载过慢时关闭简易模式的 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hymbz committed Jan 22, 2024
1 parent 2953065 commit e0b2db7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/components/Toast/ToastItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,18 @@ export const ToastItem: Component<Toast> = (props) => {
});
});

const handleClick: EventHandler['on:click'] = (e) => {
props.onClick?.();
dismiss(e);
};

return (
<div
class={classes.item}
style={{ '--theme': colorMap[props.type] }}
data-schedule={showSchedule()}
data-exit={props.exit}
on:click={dismiss}
on:click={handleClick}
onAnimationEnd={handleAnimationEnd}
>
<Dynamic component={iconMap[props.type]} />
Expand Down
1 change: 1 addition & 0 deletions src/components/Toast/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface Toast {
/** 弹窗完报错 */
throw?: true | Error;
onDismiss?: (t: Toast) => void;
onClick?: () => void;
exit?: true;
update?: true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/site/other.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ import {
toast.warn(t('site.simple.no_img'), {
id: 'no_img',
duration: Infinity,
onDismiss: async () => {
onClick: async () => {
await setOptions({ remember_current_site: false });
window.location.reload();
},
Expand Down

0 comments on commit e0b2db7

Please sign in to comment.