vuepress-theme-uniapp-official 1.6.16 → 1.6.17
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/CHANGELOG.md
CHANGED
|
@@ -134,6 +134,7 @@
|
|
|
134
134
|
</template>
|
|
135
135
|
|
|
136
136
|
<script>
|
|
137
|
+
import aa from "search-insights";
|
|
137
138
|
import searchPageConfig from '@theme-config/searchPage';
|
|
138
139
|
import NavbarLogo from '../NavbarLogo.vue';
|
|
139
140
|
import Results from './components/Results.vue';
|
|
@@ -163,11 +164,11 @@ const {
|
|
|
163
164
|
} = searchPageConfig;
|
|
164
165
|
const crawlerUrl = 'https://zh.uniapp.dcloud.io/'
|
|
165
166
|
const unidocsUrl = 'https://uniapp.dcloud.io/'
|
|
166
|
-
const docDcloudNetUrl = 'https://doc.dcloud.net.cn
|
|
167
|
+
const docDcloudNetUrl = 'https://doc.dcloud.net.cn'
|
|
167
168
|
|
|
168
169
|
const resolveRoutePathFromUrl = (url, base = '/') => {
|
|
169
170
|
// uni-app-x、uniCloud (doc.dcloud.net.cn 域名下) 等独立站点不需要转换,只需要将爬虫的域名替换为正确域名即可
|
|
170
|
-
if (location.origin
|
|
171
|
+
if (location.origin === docDcloudNetUrl) {
|
|
171
172
|
return url.replace(crawlerUrl, unidocsUrl)
|
|
172
173
|
}
|
|
173
174
|
// unidocs 文档分中英文,因此需要转换回当前站点域名 zh、en
|
|
@@ -384,13 +385,22 @@ export default {
|
|
|
384
385
|
case 'algolia':
|
|
385
386
|
this.showLoading = true;
|
|
386
387
|
this.searchByAlgolia()
|
|
387
|
-
.then(({ hitsPerPage, nbHits, nbPages, page, hits }) => {
|
|
388
|
+
.then(({ hitsPerPage, nbHits, nbPages, page, hits, queryID, indexName }) => {
|
|
388
389
|
this.resultList = hits.map(item => {
|
|
389
390
|
const items = item.getItems();
|
|
390
391
|
return {
|
|
391
392
|
...item,
|
|
392
393
|
title: removeHighlightTags(items[0]),
|
|
393
394
|
items,
|
|
395
|
+
onSelect: ({ item, event }) => {
|
|
396
|
+
aa("clickedObjectIDsAfterSearch", {
|
|
397
|
+
index: indexName,
|
|
398
|
+
eventName: `[${this.currentCategory.text}] Item Clicked`,
|
|
399
|
+
queryID,
|
|
400
|
+
objectIDs: [item.objectID],
|
|
401
|
+
positions: [1],
|
|
402
|
+
});
|
|
403
|
+
}
|
|
394
404
|
};
|
|
395
405
|
});
|
|
396
406
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import algoliasearch from 'algoliasearch/dist/algoliasearch-lite.esm.browser';
|
|
2
|
+
import aa from "search-insights";
|
|
2
3
|
import { removeHighlightTags, groupBy } from './searchUtils'
|
|
3
4
|
|
|
4
5
|
let searchClient
|
|
5
6
|
function createSearchClient(appId, apiKey) {
|
|
6
7
|
if (searchClient) return searchClient
|
|
7
8
|
searchClient = algoliasearch(appId, apiKey);
|
|
9
|
+
aa("init", { appId, apiKey });
|
|
8
10
|
searchClient.addAlgoliaAgent('dcloudsearch', '1.0.0');
|
|
9
11
|
|
|
10
12
|
return searchClient
|
|
@@ -45,6 +47,7 @@ export function search({ query, indexName, appId, apiKey, searchParameters = {},
|
|
|
45
47
|
highlightPreTag: '<mark>',
|
|
46
48
|
highlightPostTag: '</mark>',
|
|
47
49
|
hitsPerPage: 20,
|
|
50
|
+
clickAnalytics: true,
|
|
48
51
|
...searchParameters,
|
|
49
52
|
...args,
|
|
50
53
|
},
|
|
@@ -54,7 +57,7 @@ export function search({ query, indexName, appId, apiKey, searchParameters = {},
|
|
|
54
57
|
throw error;
|
|
55
58
|
})
|
|
56
59
|
.then(({ results }) => {
|
|
57
|
-
const { hits, hitsPerPage, nbHits, nbPages, page } = results[0];
|
|
60
|
+
const { hits, hitsPerPage, nbHits, nbPages, page, queryID } = results[0];
|
|
58
61
|
const sources = groupBy(hits, (hit) => removeHighlightTags(hit));
|
|
59
62
|
return {
|
|
60
63
|
hitsPerPage, nbHits, nbPages, page,
|
|
@@ -95,7 +98,9 @@ export function search({ query, indexName, appId, apiKey, searchParameters = {},
|
|
|
95
98
|
},
|
|
96
99
|
};
|
|
97
100
|
}
|
|
98
|
-
)
|
|
101
|
+
),
|
|
102
|
+
queryID,
|
|
103
|
+
indexName
|
|
99
104
|
}
|
|
100
105
|
});
|
|
101
106
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vuepress-theme-uniapp-official",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.17",
|
|
4
4
|
"description": "uni-app official website theme for vuepress",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -42,13 +42,14 @@
|
|
|
42
42
|
"markdown-it-task-lists": "^2.1.1",
|
|
43
43
|
"marked": "^3.0.8",
|
|
44
44
|
"qr-code-with-logo": "^1.1.0",
|
|
45
|
+
"search-insights": "^2.17.3",
|
|
45
46
|
"vuepress-plugin-juejin-style-copy": "^1.0.4",
|
|
46
47
|
"vuepress-plugin-mermaidjs": "1.9.1",
|
|
47
48
|
"vuepress-plugin-named-chunks": "^1.1.4",
|
|
48
49
|
"vuepress-plugin-zooming": "^1.1.8",
|
|
49
|
-
"vuepress-plugin-
|
|
50
|
+
"vuepress-plugin-check-md2": "^1.0.5",
|
|
50
51
|
"vuepress-plugin-expandable-row": "^1.0.10",
|
|
51
|
-
"vuepress-plugin-
|
|
52
|
+
"vuepress-plugin-noscript-code": "^1.0.2"
|
|
52
53
|
},
|
|
53
54
|
"resolutions": {
|
|
54
55
|
"terser-webpack-plugin": "1.4.6",
|