feat: 保存导航链接侧边栏折叠状态和搜索类型
This commit is contained in:
@@ -3,5 +3,11 @@
|
|||||||
/** 储存 key 前缀 */
|
/** 储存 key 前缀 */
|
||||||
const PREFIX = 'frost-navigation/';
|
const PREFIX = 'frost-navigation/';
|
||||||
|
|
||||||
|
/** 导航链接侧边栏折叠状态 */
|
||||||
|
export const SKEY_NAV_LINK_ASIDE_COLLAPSED = PREFIX + 'nav-link-aside-collapsed';
|
||||||
|
|
||||||
|
/** 导航链接搜索类型 */
|
||||||
|
export const SKEY_NAV_LINK_SEARCH_TYPE = PREFIX + 'nav-link-search-type';
|
||||||
|
|
||||||
/** 当前使用的搜索引擎名称 */
|
/** 当前使用的搜索引擎名称 */
|
||||||
export const SKEY_SEARCH_ENGINE_NAME = PREFIX + 'search-engine-name';
|
export const SKEY_SEARCH_ENGINE_NAME = PREFIX + 'search-engine-name';
|
||||||
|
@@ -143,6 +143,11 @@ import {
|
|||||||
NAV_MODULE_TITLE,
|
NAV_MODULE_TITLE,
|
||||||
} from '@/config/modules';
|
} from '@/config/modules';
|
||||||
|
|
||||||
|
import {
|
||||||
|
SKEY_NAV_LINK_ASIDE_COLLAPSED,
|
||||||
|
SKEY_NAV_LINK_SEARCH_TYPE,
|
||||||
|
} from '@/config/storage';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
$dialog, $message,
|
$dialog, $message,
|
||||||
} from '@/assets/js/naive-ui';
|
} from '@/assets/js/naive-ui';
|
||||||
@@ -151,6 +156,10 @@ import {
|
|||||||
formatNavLinks,
|
formatNavLinks,
|
||||||
} from '@/assets/js/nav-links';
|
} from '@/assets/js/nav-links';
|
||||||
|
|
||||||
|
import {
|
||||||
|
useLocalStorage,
|
||||||
|
} from '@vueuse/core';
|
||||||
|
|
||||||
/** 链接详情 */
|
/** 链接详情 */
|
||||||
const detailDrawer = reactive({
|
const detailDrawer = reactive({
|
||||||
|
|
||||||
@@ -163,7 +172,10 @@ const detailDrawer = reactive({
|
|||||||
});
|
});
|
||||||
|
|
||||||
/** 分类列表是否折叠 */
|
/** 分类列表是否折叠 */
|
||||||
const isCollapsed = shallowRef(false);
|
const isCollapsed = useLocalStorage(
|
||||||
|
SKEY_NAV_LINK_ASIDE_COLLAPSED,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
/** 完整的链接列表 */
|
/** 完整的链接列表 */
|
||||||
const navLinksAll = formatNavLinks(true);
|
const navLinksAll = formatNavLinks(true);
|
||||||
@@ -194,7 +206,10 @@ const navLinksTitle = shallowRef('');
|
|||||||
const searchKeyword = shallowRef('');
|
const searchKeyword = shallowRef('');
|
||||||
|
|
||||||
/** 搜索类型 */
|
/** 搜索类型 */
|
||||||
const searchType = shallowRef('all');
|
const searchType = useLocalStorage(
|
||||||
|
SKEY_NAV_LINK_SEARCH_TYPE,
|
||||||
|
'all'
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @desc 搜索类型列表
|
* @desc 搜索类型列表
|
||||||
|
Reference in New Issue
Block a user