This repository was archived by the owner on Jan 6, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 2
2
import { rpc } from ' ../logic/rpc'
3
3
import type { DocumentInfo } from ' ../../types'
4
4
import { data } from ' ../logic/documentations'
5
+ import { useFuse } from ' @vueuse/integrations/useFuse'
5
6
6
7
const rawItems = data
7
8
const items = ref (data )
@@ -21,9 +22,12 @@ function navigate(data: DocumentInfo) {
21
22
}
22
23
23
24
const keywords = ref (' ' )
25
+ const { results : filterDocuments } = useFuse (keywords , rawItems .map (i => i .name ), {
26
+ matchAllWhenSearchEmpty: true
27
+ })
24
28
25
- watch (keywords , () => {
26
- items .value = rawItems .filter (item => packagesName . includes (item .id ) && ( item . id . includes (keywords . value ) || keywords . value . length === 0 ))
29
+ watch (filterDocuments , () => {
30
+ items .value = rawItems .filter (item => ( filterDocuments . value . map ( i => i . item ). includes (item .name ) && packagesName . includes (item . id ) ))
27
31
})
28
32
29
33
function back() {
@@ -39,10 +43,8 @@ function back() {
39
43
<div v-if =" iframeViewUrl" >
40
44
<IframeView :src =" iframeViewUrl" />
41
45
<teleport to =" body" >
42
- <span
43
- fixed left-2 top-2 z-1000 h-8 w-8 flex cursor-pointer select-none items-center justify-center rounded-5
44
- bg-base hover =" text-primary" @click.prevent.stop =" back"
45
- >
46
+ <span fixed left-2 top-2 z-1000 h-8 w-8 flex cursor-pointer select-none items-center justify-center rounded-5
47
+ bg-base hover =" text-primary" @click.prevent.stop =" back" >
46
48
<i tabler:arrow-back-up />
47
49
</span >
48
50
</teleport >
Original file line number Diff line number Diff line change @@ -105,8 +105,8 @@ export interface DocumentInfo {
105
105
website : string
106
106
github : string
107
107
icon : string
108
- tips : string
109
- openInBlank : boolean
108
+ tips ? : string
109
+ openInBlank ? : boolean
110
110
}
111
111
112
112
export interface PackageInfo {
You can’t perform that action at this time.
0 commit comments