Skip to content

Commit 7385b0a

Browse files
committed
2.0.1
1. 新增 Placement 样式
1 parent 7cdd0a9 commit 7385b0a

12 files changed

+156
-21
lines changed

README.md

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,68 @@ Trigger触发组件
1111

1212
[![Edit react-wiget-trigger](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/react-wiget-trigger-llvwn?fontsize=14&hidenavigation=1&theme=dark)
1313

14+
```js
15+
import React from "react";
16+
import Trigger from "react-widget-trigger";
17+
import "react-widget-trigger/style";
18+
import "./styles.css";
19+
20+
export default function App() {
21+
return (
22+
<div
23+
className="App"
24+
style={{
25+
padding: 100
26+
}}
27+
>
28+
<Trigger
29+
offset={1}
30+
placement="bottomRight"
31+
popup={trigger => (
32+
<div
33+
style={{
34+
width: 100,
35+
height: 100,
36+
border: "1px solid #f2f2f2",
37+
padding: 10
38+
}}
39+
>
40+
<div>Title</div>
41+
<div>
42+
Content
43+
<Trigger
44+
usePortal={false}
45+
action="hover"
46+
delay={50}
47+
offset={1}
48+
popup={
49+
<div
50+
style={{
51+
width: 150
52+
}}
53+
>
54+
hover popup test...
55+
</div>
56+
}
57+
>
58+
<a href="###">Hover</a>
59+
</Trigger>
60+
</div>
61+
62+
<button onClick={() => trigger.hide()}>关闭</button>
63+
</div>
64+
)}
65+
action={["click"]}
66+
>
67+
<button>点击试试</button>
68+
</Trigger>
69+
</div>
70+
);
71+
}
72+
73+
74+
```
75+
1476

1577
### Interfaces
1678

@@ -99,11 +161,9 @@ export interface TriggerState {
99161
export declare class Trigger extends React.Component<TriggerProps, TriggerState> {
100162
popupInstance: Popup;
101163
triggerInstance: React.ReactInstance;
102-
componentDidMount(): void;
103-
componentDidUpdate(): void;
104-
componentWillUnmount(): void;
105164
show(): void;
106165
hide(): void;
166+
updatePopupPosition(): void;
107167
}
108168
export default Trigger;
109169
```
@@ -138,6 +198,7 @@ export default Trigger;
138198
.rw-trigger-root {
139199
position: absolute;
140200
left: 0;
201+
right: 0;
141202
top: 0;
142203
}
143204

@@ -159,4 +220,5 @@ export default Trigger;
159220
z-index: 2000;
160221
}
161222

223+
162224
```

docs/asset-manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"index.css": "static/css/index.a9115b2c.chunk.css",
3-
"index.js": "static/js/index.a9115b2c.chunk.js",
2+
"index.css": "static/css/index.8833ee44.chunk.css",
3+
"index.js": "static/js/index.8833ee44.chunk.js",
44
"runtime-index.js": "static/js/runtime-index.7c9988e7.js",
5-
"static/js/2.74857955.chunk.js": "static/js/2.74857955.chunk.js",
5+
"static/js/2.f1bfc8b5.chunk.js": "static/js/2.f1bfc8b5.chunk.js",
66
"index.html": "index.html"
77
}

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html><html><head><meta charset="utf-8"/><title>trigger</title><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1"/><style>.demo{width:800px;height:450px;margin:100px auto;background:#fff;font-size:12px;overflow:auto}</style><link href="static/css/index.a9115b2c.chunk.css" rel="stylesheet"></head><body style="background:#f5f5f5"><div class="demo" id="demo"></div><script src="static/js/runtime-index.7c9988e7.js"></script><script src="static/js/2.74857955.chunk.js"></script><script src="static/js/index.a9115b2c.chunk.js"></script></body></html>
1+
<!doctype html><html><head><meta charset="utf-8"/><title>trigger</title><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1"/><style>.demo{width:800px;height:450px;margin:100px auto;background:#fff;font-size:12px;overflow:auto}</style><link href="static/css/index.8833ee44.chunk.css" rel="stylesheet"></head><body style="background:#f5f5f5"><div class="demo" id="demo"></div><script src="static/js/runtime-index.7c9988e7.js"></script><script src="static/js/2.f1bfc8b5.chunk.js"></script><script src="static/js/index.8833ee44.chunk.js"></script></body></html>

docs/static/css/index.a9115b2c.chunk.css renamed to docs/static/css/index.8833ee44.chunk.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/static/js/2.74857955.chunk.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/static/js/2.f1bfc8b5.chunk.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/static/js/index.8833ee44.chunk.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)