diff --git a/CHANGELOG.md b/CHANGELOG.md index 006d314..3a41ada 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +# 1.1.0 (2023-03-05) + + +### ✨ Features + +* **custom**: 添加一键清除历史记录功能 ([51d25cf](https://vlink.dev/EOEFANS/eoefans-web/commits/51d25cf)) + + + ## 1.0.5 (2023-03-05) diff --git a/package.json b/package.json index 9e5558c..3daab71 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eoefans-web", - "version": "1.0.5", + "version": "1.1.0", "type": "module", "scripts": { "dev": "vite --config ./config/vite.dev.config.ts", diff --git a/src/routers/layout/search/pc/search.tsx b/src/routers/layout/search/pc/search.tsx index 5abb2a1..d23e23c 100644 --- a/src/routers/layout/search/pc/search.tsx +++ b/src/routers/layout/search/pc/search.tsx @@ -105,6 +105,7 @@ const NormalSearch = () => { handlerNavigate(value); }, handerHistorySubmit = (value: string) => { + inputRef.current!.value = value; handlerNavigate(value); addPCTagHistory(value); }; @@ -152,10 +153,12 @@ const AdvanceSearch = forwardRef(function Advance(props, ref) { onBlur(); }, handlerTagHistorySubmit = (tag: string) => { + tagRef.current!.value = tag; handlerNavigate(tag, getNameValue()); addPCTagHistory(tag); }, handlerNameHistorySubmit = (name: string) => { + nameRef.current!.value = name; handlerNavigate(getTagValue(), name); addPCNameHistory(name); }; diff --git a/src/routers/layout/search/pc/searchSuggest.tsx b/src/routers/layout/search/pc/searchSuggest.tsx index 2032073..6a2dd31 100644 --- a/src/routers/layout/search/pc/searchSuggest.tsx +++ b/src/routers/layout/search/pc/searchSuggest.tsx @@ -3,6 +3,7 @@ import HistoryToggleOffIcon from "@mui/icons-material/HistoryToggleOff"; import TagIcon from "@mui/icons-material/Tag"; import AccessibilityNewIcon from "@mui/icons-material/AccessibilityNew"; import { Popper } from "@mui/material"; +import ClearAllIcon from "@mui/icons-material/ClearAll"; import { Storage } from "@routers/layout/tools"; import { useURLParams } from "@utils/hooks/url"; import { FC, ReactElement, useEffect, useMemo, useState } from "react"; @@ -24,6 +25,7 @@ export const addPCTagHistory = (value: string) => { [value, ...oldHistory.filter((item) => item !== value)].slice(0, 5) ); }; +const clearPCTagHistory = () => PCTagStorage.clearLocalstorage(); const usePCTagHistory = () => { const local_history: renderSuggestItemLists = PCTagStorage.getLocalStorage( [] @@ -64,6 +66,24 @@ const useSuggestOption = (open: boolean) => { return [fixedOpen]; }; +const HistoryTitleItem: FC<{ onClear: () => void }> = ({ onClear }) => { + return ( + <> +
+
+