Skip to content

Commit 49c4dc6

Browse files
authored
feat(demo): use Tour component replace dirverjs (vbenjs#3777)
* feat(demo): use Tour component replace dirverjs * chore(deps): remove dirverjs package
1 parent 0ffd777 commit 49c4dc6

File tree

3 files changed

+30
-40
lines changed

3 files changed

+30
-40
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
"cropperjs": "^1.6.1",
8484
"crypto-js": "^4.2.0",
8585
"dayjs": "^1.11.10",
86-
"driver.js": "^1.3.1",
8786
"echarts": "^5.5.0",
8887
"exceljs": "^4.4.0",
8988
"lodash-es": "^4.17.21",

pnpm-lock.yaml

+3-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/views/demo/steps/index.vue

+27-30
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,38 @@
11
<template>
22
<PageWrapper title="引导页" content="用于给用户的指引操作">
3-
<a-button type="primary" @click="handleStart">开始</a-button>
3+
<a-button type="primary" @click="handleOpen(true)">开始</a-button>
4+
<Tour v-model:current="current" :open="open" :steps="steps" @close="handleOpen(false)" />
45
</PageWrapper>
56
</template>
67
<script lang="ts" setup>
78
import { PageWrapper } from '@/components/Page';
89
import { useDesign } from '@/hooks/web/useDesign';
9-
import { driver } from 'driver.js';
10-
import 'driver.js/dist/driver.css';
10+
import { ref } from 'vue';
11+
import { Tour, TourProps } from 'ant-design-vue';
1112
13+
const open = ref<boolean>(false);
1214
const { prefixVar } = useDesign('');
1315
14-
function handleStart() {
15-
driver({
16-
showProgress: true,
17-
steps: [
18-
{
19-
popover: {
20-
title: 'Welcome',
21-
description: 'Hello World! 👋',
22-
},
23-
},
24-
{
25-
element: `.${prefixVar}-layout-header-trigger`,
26-
popover: {
27-
title: 'Collapse Button',
28-
description: 'This is the menu collapse button.',
29-
},
30-
},
31-
{
32-
element: `.${prefixVar}-layout-header-action`,
33-
popover: {
34-
title: 'User Action',
35-
description: 'This is the user function area.',
36-
},
37-
},
38-
],
39-
}).drive();
40-
}
16+
const current = ref(0);
17+
const steps: TourProps['steps'] = [
18+
{
19+
title: 'Welcome',
20+
description: 'Hello World! 👋',
21+
},
22+
{
23+
title: 'Collapse Button',
24+
description: 'This is the menu collapse button.',
25+
target: () => document.querySelector(`.${prefixVar}-layout-header-trigger`) as HTMLElement,
26+
},
27+
{
28+
title: 'User Action',
29+
description: 'This is the user function area.',
30+
target: () => document.querySelector(`.${prefixVar}-layout-header-action`) as HTMLElement,
31+
},
32+
];
33+
34+
const handleOpen = (val: boolean): void => {
35+
current.value = 0;
36+
open.value = val;
37+
};
4138
</script>

0 commit comments

Comments
 (0)