提交 | 用户 | 时间
|
820397
|
1 |
import { Config, driver } from 'driver.js' |
H |
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 |
} |