-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathdefaultCurrent.tsx
More file actions
53 lines (49 loc) · 1.3 KB
/
defaultCurrent.tsx
File metadata and controls
53 lines (49 loc) · 1.3 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { useRef, useState } from "react";
import Tour from '../../src/index';
export default () => {
const btn1Ref = useRef<HTMLButtonElement>(null);
const btn2Ref = useRef<HTMLButtonElement>(null);
const [open, setOpen] = useState(false)
return <div style={{ margin: 20 }}>
<div>
<button
className="ant-target"
ref={btn1Ref}
style={{ marginLeft: 100 }}
onClick={() => {
setOpen(true);
}}
>
button1
</button>
<button className="ant-target" ref={btn2Ref} style={{ marginLeft: 100 }}>
defaultOpen
</button>
</div>
<div style={{ height: 200 }} />
<Tour
defaultCurrent={1}
open={open}
onFinish={() => setOpen(false)}
onClose={() => setOpen(false)}
steps={[
{
title: '创建',
description: '创建一条数据',
target: () => btn1Ref.current,
mask: true,
},
{
title: '更新',
description: (
<div>
<span>更新一条数据</span>
<button>帮助文档</button>
</div>
),
target: () => btn2Ref.current,
},
]}
/>
</div>
}