-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(demo): use Tour component replace dirverjs (#3777)
* feat(demo): use Tour component replace dirverjs * chore(deps): remove dirverjs package
- Loading branch information
1 parent
0ffd777
commit 49c4dc6
Showing
3 changed files
with
30 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,38 @@ | ||
<template> | ||
<PageWrapper title="引导页" content="用于给用户的指引操作"> | ||
<a-button type="primary" @click="handleStart">开始</a-button> | ||
<a-button type="primary" @click="handleOpen(true)">开始</a-button> | ||
<Tour v-model:current="current" :open="open" :steps="steps" @close="handleOpen(false)" /> | ||
</PageWrapper> | ||
</template> | ||
<script lang="ts" setup> | ||
import { PageWrapper } from '@/components/Page'; | ||
import { useDesign } from '@/hooks/web/useDesign'; | ||
import { driver } from 'driver.js'; | ||
import 'driver.js/dist/driver.css'; | ||
import { ref } from 'vue'; | ||
import { Tour, TourProps } from 'ant-design-vue'; | ||
const open = ref<boolean>(false); | ||
const { prefixVar } = useDesign(''); | ||
function handleStart() { | ||
driver({ | ||
showProgress: true, | ||
steps: [ | ||
{ | ||
popover: { | ||
title: 'Welcome', | ||
description: 'Hello World! 👋', | ||
}, | ||
}, | ||
{ | ||
element: `.${prefixVar}-layout-header-trigger`, | ||
popover: { | ||
title: 'Collapse Button', | ||
description: 'This is the menu collapse button.', | ||
}, | ||
}, | ||
{ | ||
element: `.${prefixVar}-layout-header-action`, | ||
popover: { | ||
title: 'User Action', | ||
description: 'This is the user function area.', | ||
}, | ||
}, | ||
], | ||
}).drive(); | ||
} | ||
const current = ref(0); | ||
const steps: TourProps['steps'] = [ | ||
{ | ||
title: 'Welcome', | ||
description: 'Hello World! 👋', | ||
}, | ||
{ | ||
title: 'Collapse Button', | ||
description: 'This is the menu collapse button.', | ||
target: () => document.querySelector(`.${prefixVar}-layout-header-trigger`) as HTMLElement, | ||
}, | ||
{ | ||
title: 'User Action', | ||
description: 'This is the user function area.', | ||
target: () => document.querySelector(`.${prefixVar}-layout-header-action`) as HTMLElement, | ||
}, | ||
]; | ||
const handleOpen = (val: boolean): void => { | ||
current.value = 0; | ||
open.value = val; | ||
}; | ||
</script> |