16
16
</template >
17
17
18
18
<script >
19
- function isSpecialClick (event ) {
19
+ function isSpecialClick (event ) {
20
20
return event .button === 1 || event .altKey || event .ctrlKey || event .metaKey || event .shiftKey
21
21
}
22
22
@@ -32,26 +32,26 @@ export default {
32
32
}
33
33
},
34
34
watch: {
35
- ' $i18n.locale' (newValue) {
35
+ ' $i18n.locale' (newValue) {
36
36
this .update (this .options , newValue)
37
37
},
38
- options (newValue ) {
38
+ options (newValue ) {
39
39
this .update (newValue, this .$i18n .locale )
40
40
}
41
41
},
42
- mounted () {
42
+ mounted () {
43
43
this .initialize (this .options , this .$i18n .locale )
44
44
},
45
45
methods: {
46
- stripTrailingSlash (url ) {
46
+ stripTrailingSlash (url ) {
47
47
return url .replace (/ \/ $ | \/ (?=\? )| \/ (?=#)/ g , ' ' )
48
48
},
49
- getRelativePath (absoluteUrl ) {
49
+ getRelativePath (absoluteUrl ) {
50
50
const { pathname , hash } = new URL (absoluteUrl)
51
51
const url = pathname .replace (this .settings .url , ' /' ) + hash
52
52
return this .stripTrailingSlash (url)
53
53
},
54
- async initialize (userOptions , code ) {
54
+ async initialize (userOptions , code ) {
55
55
const lang = this .$i18n .locales .find (locale => locale .code === code)
56
56
57
57
const docsearch = await Promise .all ([
@@ -63,11 +63,13 @@ export default {
63
63
... userOptions,
64
64
container: ' #docsearch' ,
65
65
searchParameters: {
66
- ... ((! lang) ? {} : {
67
- facetFilters: [` ${ userOptions .langAttribute || ' language' } :${ lang .iso } ` ].concat (
68
- userOptions .facetFilters || []
69
- )
70
- }),
66
+ ... ((! lang)
67
+ ? {}
68
+ : {
69
+ facetFilters: [` ${ userOptions .langAttribute || ' language' } :${ lang .iso } ` ].concat (
70
+ userOptions .facetFilters || []
71
+ )
72
+ })
71
73
},
72
74
navigator : {
73
75
navigate : ({ itemUrl }) => {
@@ -97,7 +99,7 @@ export default {
97
99
__v: 1,
98
100
props: {
99
101
href: hit.url,
100
- children: children ,
102
+ children,
101
103
onClick: (event ) => {
102
104
if (isSpecialClick (event )) {
103
105
return
@@ -119,13 +121,13 @@ export default {
119
121
}
120
122
121
123
this .$router .push (hit .url )
122
- },
124
+ }
123
125
}
124
126
}
125
127
}
126
128
})
127
129
},
128
- update (options , lang ) {
130
+ update (options , lang ) {
129
131
return this .initialize (options, lang)
130
132
}
131
133
}
0 commit comments