Ben Lin
2024-06-20 de7e6c408b6209158b08991d729c4bcc72055eec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<template>
  <PageWrapper title="引导页" content="用于给用户的指引操作">
    <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 { ref } from 'vue';
  import { Tour, TourProps } from 'ant-design-vue';
 
  const open = ref<boolean>(false);
  const { prefixVar } = useDesign('');
 
  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>