|
1 | | -import Trigger from '@rc-component/trigger'; |
| 1 | +import Trigger, { UniqueProvider } from '@rc-component/trigger'; |
2 | 2 | import React from 'react'; |
3 | 3 | import '../../assets/index.less'; |
4 | 4 |
|
@@ -27,47 +27,49 @@ function getPopupContainer(trigger) { |
27 | 27 |
|
28 | 28 | const MovingPopupDemo = () => { |
29 | 29 | return ( |
30 | | - <div style={{ margin: 100 }}> |
31 | | - <div style={{ display: 'flex', gap: 20 }}> |
32 | | - <Trigger |
33 | | - action={['hover']} |
34 | | - popupPlacement="top" |
35 | | - builtinPlacements={builtinPlacements} |
36 | | - getPopupContainer={getPopupContainer} |
37 | | - popupMotion={{ |
38 | | - motionName: 'rc-trigger-popup-zoom', |
39 | | - }} |
40 | | - popup={<div>这是左侧按钮的提示信息</div>} |
41 | | - popupStyle={{ |
42 | | - border: '1px solid #ccc', |
43 | | - padding: 10, |
44 | | - background: 'white', |
45 | | - boxSizing: 'border-box', |
46 | | - }} |
47 | | - > |
48 | | - <button type="button">左侧按钮</button> |
49 | | - </Trigger> |
50 | | - |
51 | | - <Trigger |
52 | | - action={['hover']} |
53 | | - popupPlacement="top" |
54 | | - builtinPlacements={builtinPlacements} |
55 | | - getPopupContainer={getPopupContainer} |
56 | | - popupMotion={{ |
57 | | - motionName: 'rc-trigger-popup-zoom', |
58 | | - }} |
59 | | - popup={<div>This is the tooltip for the right button</div>} |
60 | | - popupStyle={{ |
61 | | - border: '1px solid #ccc', |
62 | | - padding: 10, |
63 | | - background: 'white', |
64 | | - boxSizing: 'border-box', |
65 | | - }} |
66 | | - > |
67 | | - <button type="button">Right Button</button> |
68 | | - </Trigger> |
| 30 | + <UniqueProvider> |
| 31 | + <div style={{ margin: 100 }}> |
| 32 | + <div style={{ display: 'flex', gap: 20 }}> |
| 33 | + <Trigger |
| 34 | + action={['hover']} |
| 35 | + popupPlacement="top" |
| 36 | + builtinPlacements={builtinPlacements} |
| 37 | + getPopupContainer={getPopupContainer} |
| 38 | + popupMotion={{ |
| 39 | + motionName: 'rc-trigger-popup-zoom', |
| 40 | + }} |
| 41 | + popup={<div>这是左侧按钮的提示信息</div>} |
| 42 | + popupStyle={{ |
| 43 | + border: '1px solid #ccc', |
| 44 | + padding: 10, |
| 45 | + background: 'white', |
| 46 | + boxSizing: 'border-box', |
| 47 | + }} |
| 48 | + > |
| 49 | + <button type="button">左侧按钮</button> |
| 50 | + </Trigger> |
| 51 | + |
| 52 | + <Trigger |
| 53 | + action={['hover']} |
| 54 | + popupPlacement="top" |
| 55 | + builtinPlacements={builtinPlacements} |
| 56 | + getPopupContainer={getPopupContainer} |
| 57 | + popupMotion={{ |
| 58 | + motionName: 'rc-trigger-popup-zoom', |
| 59 | + }} |
| 60 | + popup={<div>This is the tooltip for the right button</div>} |
| 61 | + popupStyle={{ |
| 62 | + border: '1px solid #ccc', |
| 63 | + padding: 10, |
| 64 | + background: 'white', |
| 65 | + boxSizing: 'border-box', |
| 66 | + }} |
| 67 | + > |
| 68 | + <button type="button">Right Button</button> |
| 69 | + </Trigger> |
| 70 | + </div> |
69 | 71 | </div> |
70 | | - </div> |
| 72 | + </UniqueProvider> |
71 | 73 | ); |
72 | 74 | }; |
73 | 75 |
|
|
0 commit comments