Skip to content

Commit 4ba264e

Browse files
committed
perf: use driver.js
1 parent f26a4ca commit 4ba264e

File tree

4 files changed

+50
-50
lines changed

4 files changed

+50
-50
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@
4444
"crypto-js": "^4.2.0",
4545
"dayjs": "^1.11.10",
4646
"diagram-js": "^12.6.0",
47+
"driver.js": "^1.3.0",
4748
"echarts": "^5.4.3",
4849
"echarts-wordcloud": "^2.1.0",
4950
"element-plus": "2.4.1",
5051
"fast-xml-parser": "^4.3.2",
5152
"highlight.js": "^11.9.0",
52-
"intro.js": "^7.2.0",
5353
"jsencrypt": "^3.3.2",
5454
"lodash-es": "^4.17.21",
5555
"min-dash": "^4.1.1",
@@ -77,7 +77,6 @@
7777
"@iconify/json": "^2.2.135",
7878
"@intlify/unplugin-vue-i18n": "^1.4.0",
7979
"@purge-icons/generated": "^0.9.0",
80-
"@types/intro.js": "^5.1.3",
8180
"@types/lodash-es": "^4.17.10",
8281
"@types/node": "^20.8.9",
8382
"@types/nprogress": "^0.2.2",

src/hooks/web/useGuide.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { Config, driver } from 'driver.js'
2+
import 'driver.js/dist/driver.css'
3+
import { useDesign } from '@/hooks/web/useDesign'
4+
import { useI18n } from '@/hooks/web/useI18n'
5+
6+
const { t } = useI18n()
7+
8+
const { variables } = useDesign()
9+
10+
export const useGuide = (options?: Config) => {
11+
const driverObj = driver(
12+
options || {
13+
showProgress: true,
14+
nextBtnText: t('common.nextLabel'),
15+
prevBtnText: t('common.prevLabel'),
16+
doneBtnText: t('common.doneLabel'),
17+
steps: [
18+
{
19+
element: `#${variables.namespace}-menu`,
20+
popover: {
21+
title: t('common.menu'),
22+
description: t('common.menuDes'),
23+
side: 'right'
24+
}
25+
},
26+
{
27+
element: `#${variables.namespace}-tool-header`,
28+
popover: {
29+
title: t('common.tool'),
30+
description: t('common.toolDes'),
31+
side: 'left'
32+
}
33+
},
34+
{
35+
element: `#${variables.namespace}-tags-view`,
36+
popover: {
37+
title: t('common.tagsView'),
38+
description: t('common.tagsViewDes'),
39+
side: 'bottom'
40+
}
41+
}
42+
]
43+
}
44+
)
45+
46+
return {
47+
...driverObj
48+
}
49+
}

src/hooks/web/useIntro.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"@intlify/unplugin-vue-i18n/types",
2828
"vite/client",
2929
"element-plus/global",
30-
"@types/intro.js",
3130
"@types/qrcode",
3231
"vite-plugin-svg-icons/client"
3332
],

0 commit comments

Comments
 (0)