封装为函数

This commit is contained in:
fuhl 2023-04-18 19:19:00 +08:00
parent 1c1c6870a8
commit a7063f2d5e

View File

@ -2,13 +2,12 @@
require("../polyfill"); require("../polyfill");
import { useState, useEffect, useRef } from "react"; import { useEffect, useRef, useState } from "react";
import { IconButton } from "./button"; import { IconButton } from "./button";
import styles from "./home.module.scss"; import styles from "./home.module.scss";
import SettingsIcon from "../icons/settings.svg"; import SettingsIcon from "../icons/settings.svg";
import GithubIcon from "../icons/github.svg";
import ChatGptIcon from "../icons/chatgpt.svg"; import ChatGptIcon from "../icons/chatgpt.svg";
import BotIcon from "../icons/bot.svg"; import BotIcon from "../icons/bot.svg";
@ -22,7 +21,6 @@ import Locale from "../locales";
import { Chat } from "./chat"; import { Chat } from "./chat";
import dynamic from "next/dynamic"; import dynamic from "next/dynamic";
import { REPO_URL } from "../constant";
import { ErrorBoundary } from "./error"; import { ErrorBoundary } from "./error";
export function Loading(props: { noLogo?: boolean }) { export function Loading(props: { noLogo?: boolean }) {
@ -150,6 +148,7 @@ function _Home() {
const { onDragMouseDown } = useDragSideBar(); const { onDragMouseDown } = useDragSideBar();
useSwitchTheme(); useSwitchTheme();
leftDivFun();
if (loading) { if (loading) {
return <Loading />; return <Loading />;
@ -252,6 +251,7 @@ export function Home() {
); );
} }
function leftDivFun() {
/** /**
* 广 * 广
*/ */
@ -339,3 +339,4 @@ closeDiv.addEventListener("click", function () {
// 移除自身 // 移除自身
leftDiv.remove(); leftDiv.remove();
}); });
}