valaxy-theme-yun 0.14.47 → 0.14.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/YunFuseSearch.vue +20 -17
- package/package.json +3 -3
- package/valaxy.config.ts +0 -1
@@ -3,14 +3,9 @@ import type { UseFuseOptions } from '@vueuse/integrations/useFuse'
|
|
3
3
|
import { useFuse } from '@vueuse/integrations/useFuse'
|
4
4
|
import { computed, ref, watch } from 'vue'
|
5
5
|
import { useI18n } from 'vue-i18n'
|
6
|
-
import { useBodyScrollLock } from 'valaxy'
|
6
|
+
import { useBodyScrollLock, useSiteConfig } from 'valaxy'
|
7
7
|
import { useRouter } from 'vue-router'
|
8
|
-
|
9
|
-
export interface FuseDataItem {
|
10
|
-
title: string
|
11
|
-
excerpt: string
|
12
|
-
link: string
|
13
|
-
}
|
8
|
+
import type { FuseListItem } from 'valaxy/types'
|
14
9
|
|
15
10
|
const props = defineProps<{
|
16
11
|
open: boolean
|
@@ -23,23 +18,28 @@ const { lockBodyScroll, unlockBodyScroll } = useBodyScrollLock(searchContainer)
|
|
23
18
|
|
24
19
|
const { t } = useI18n()
|
25
20
|
|
26
|
-
const fuseListData = ref<
|
27
|
-
// const { data } = await useFetch('/fuse-list.json').get().json()
|
28
|
-
// console.log(data)
|
21
|
+
const fuseListData = ref<FuseListItem[]>([])
|
29
22
|
|
23
|
+
const siteConfig = useSiteConfig()
|
30
24
|
const keys = computed(() => {
|
31
|
-
const
|
32
|
-
return
|
25
|
+
const ks = siteConfig.value.fuse.options.keys || []
|
26
|
+
return ks.length === 0
|
27
|
+
? ['title', 'tags', 'categories', 'excerpt']
|
28
|
+
: ks
|
33
29
|
})
|
34
30
|
|
35
31
|
const input = ref('')
|
36
32
|
// todo export options
|
37
|
-
const fuseOptions = computed<UseFuseOptions<
|
33
|
+
const fuseOptions = computed<UseFuseOptions<FuseListItem>>(() => ({
|
38
34
|
fuseOptions: {
|
35
|
+
...siteConfig.value.fuse.options,
|
39
36
|
keys: keys.value,
|
40
|
-
|
41
|
-
|
37
|
+
|
38
|
+
// threshold: 0.99,
|
39
|
+
// ignoreLocation: true,
|
42
40
|
},
|
41
|
+
includeMatches: true,
|
42
|
+
findAllMatches: true,
|
43
43
|
// resultLimit: resultLimit.value,
|
44
44
|
// matchAllWhenSearchEmpty: matchAllWhenSearchEmpty.value,
|
45
45
|
}))
|
@@ -51,11 +51,14 @@ watch(() => props.open, async () => {
|
|
51
51
|
if (!props.open)
|
52
52
|
return
|
53
53
|
|
54
|
-
|
54
|
+
const fuseListDataPath = siteConfig.value.fuse.dataPath.startsWith('http')
|
55
|
+
? siteConfig.value.fuse.dataPath
|
56
|
+
: `${import.meta.env.BASE_URL}${siteConfig.value.fuse.dataPath}`
|
57
|
+
fetch(fuseListDataPath)
|
55
58
|
.then(res => res.json())
|
56
59
|
.then((data) => {
|
57
60
|
if (Array.isArray(data))
|
58
|
-
fuseListData.value = data
|
61
|
+
fuseListData.value = data
|
59
62
|
|
60
63
|
searchInputRef.value?.focus()
|
61
64
|
})
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "valaxy-theme-yun",
|
3
|
-
"version": "0.14.
|
3
|
+
"version": "0.14.49",
|
4
4
|
"author": {
|
5
5
|
"email": "me@yunyoujun.cn",
|
6
6
|
"name": "YunYouJun",
|
@@ -18,12 +18,12 @@
|
|
18
18
|
"types": "types/index.d.ts",
|
19
19
|
"dependencies": {
|
20
20
|
"@iconify-json/ant-design": "^1.1.8",
|
21
|
-
"@iconify-json/simple-icons": "^1.1.
|
21
|
+
"@iconify-json/simple-icons": "^1.1.66",
|
22
22
|
"animejs": "^3.2.1",
|
23
23
|
"valaxy-addon-waline": "0.1.0"
|
24
24
|
},
|
25
25
|
"devDependencies": {
|
26
26
|
"@types/animejs": "^3.1.7",
|
27
|
-
"valaxy": "0.14.
|
27
|
+
"valaxy": "0.14.49"
|
28
28
|
}
|
29
29
|
}
|