diff --git a/docs/.vitepress/src/assets/style/mixin/common.scss b/docs/.vitepress/src/assets/style/mixin/common.scss index d79b555c73922728c0358bdb29287bccc5b59ef7..b3435e070ca02f05f75124c5111962db6bb9a4f9 100644 --- a/docs/.vitepress/src/assets/style/mixin/common.scss +++ b/docs/.vitepress/src/assets/style/mixin/common.scss @@ -42,9 +42,24 @@ transition: all var(--o-duration-m1) var(--o-easing-standard-in); } - &:hover { + @include hover { .o-icon { transform: rotate(-180deg); } } } + +@mixin x-svg-hover() { + & { + overflow: hidden; + } + + svg { + transition: all var(--o-duration-m1) var(--o-easing-standard-in); + } + @include hover { + svg { + transform: rotate(180deg); + } + } +} diff --git a/docs/.vitepress/src/components/header/HeaderSearch.vue b/docs/.vitepress/src/components/header/HeaderSearch.vue index 1b6e3d5ab4603be1c0e43323a0d8bd12e61209d5..da88eb63e4959f194e56b30d58894759308e99e5 100644 --- a/docs/.vitepress/src/components/header/HeaderSearch.vue +++ b/docs/.vitepress/src/components/header/HeaderSearch.vue @@ -4,8 +4,6 @@ import { OInput, OIcon } from '@opensig/opendesign'; import { useData } from 'vitepress'; import { useAppearance } from '@/stores/common'; -import useClickOutside from '@/components/hooks/useClickOutside'; -import { useScreen } from '@/composables/useScreen'; import i18n from '@/i18n'; import { useLocale } from '@/composables/useLocale'; @@ -13,6 +11,9 @@ import type { SearchRecommendT } from '@/@types/type-search'; import { getPop, getSearchRecommend } from '@/api/api-search'; +import useClickOutside from '@/components/hooks/useClickOutside'; +import { useScreen } from '@/composables/useScreen'; + import IconClose from '~icons/app/icon-close.svg'; import IconSearch from '~icons/app/icon-header-search.svg'; import IconDelete from '~icons/app/icon-header-delete.svg'; @@ -20,6 +21,7 @@ import IconDeleteAll from '~icons/app/icon-delete.svg'; import IconBack from '~icons/app/icon-header-back.svg'; const { lang } = useData(); + const searchRef = ref(); const isClickOutside = useClickOutside(searchRef) || false; const { lePadV } = useScreen(); @@ -108,7 +110,7 @@ const searchHistory = ref([]); const loadSearchHistory = () => { // 从 localStorage 加载搜索历史 - const history = localStorage.getItem('searchHistory'); + const history = localStorage.getItem('search-history'); if (history) { searchHistory.value = JSON.parse(history); } @@ -123,20 +125,20 @@ const handleSearch = (searchValue: string) => { // 最多保持6条搜集记录 searchHistory.value.pop(); } - localStorage.setItem('searchHistory', JSON.stringify(searchHistory.value)); + localStorage.setItem('search-history', JSON.stringify(searchHistory.value)); } }; const deleteHistory = (data: string) => { if (!data) { - localStorage.removeItem('searchHistory'); + localStorage.removeItem('search-history'); searchHistory.value = []; } - const history = localStorage.getItem('searchHistory'); + const history = localStorage.getItem('search-history'); if (history) { searchHistory.value = JSON.parse(history).filter((s: string) => s !== data); - localStorage.setItem('searchHistory', JSON.stringify(searchHistory.value)); + localStorage.setItem('search-history', JSON.stringify(searchHistory.value)); } }; @@ -153,7 +155,7 @@ const closeSearch = () => {