From 49ec88f0a1b4aeaa08fec88b63507c7cd0bc3294 Mon Sep 17 00:00:00 2001 From: leonwgc Date: Fri, 19 Apr 2024 14:42:08 +0800 Subject: [PATCH] docs: demo --- demo/App1.tsx | 11 +++++---- docs/{index.79e642.js => index.a48c5f.js} | 28 +++++++++++------------ docs/index.html | 2 +- 3 files changed, 21 insertions(+), 20 deletions(-) rename docs/{index.79e642.js => index.a48c5f.js} (98%) diff --git a/demo/App1.tsx b/demo/App1.tsx index 27bcc6c..3c76bff 100644 --- a/demo/App1.tsx +++ b/demo/App1.tsx @@ -32,13 +32,14 @@ export default function App() { const [visible, setVisible] = useState(true); const ref = useRef(0); + const ref1 = useRef(0); const elRef = useRef(); const btnRef = useRef(); const forceRender = useForceUpdate(); useEffect(() => { - const p = placements[ref.current++] as any; + const p = placements[ref.current] as any; Popover.show({ anchor: elRef, style: { background: '#666', color: '#fff' }, @@ -48,7 +49,7 @@ export default function App() { }, []); const handlePkg = () => { - const p = placements[ref.current++] as any; + const p = placements[ref1.current++] as any; Popover.show({ anchor: elRef, @@ -57,8 +58,8 @@ export default function App() { placement: p, }); - if (ref.current > 11) { - ref.current = 0; + if (ref1.current > 11) { + ref1.current = 0; } }; @@ -109,7 +110,7 @@ export default function App() { -
+ {/*
*/} ); diff --git a/docs/index.79e642.js b/docs/index.a48c5f.js similarity index 98% rename from docs/index.79e642.js rename to docs/index.a48c5f.js index 0cb6835..673045e 100644 --- a/docs/index.79e642.js +++ b/docs/index.a48c5f.js @@ -834,27 +834,28 @@ n = e[0], o = e[1], c = (0, r.useRef)(0), - l = (0, r.useRef)(), + l = (0, r.useRef)(0), p = (0, r.useRef)(), - d = (0, u.Z)(); + d = (0, r.useRef)(), + m = (0, u.Z)(); (0, r.useEffect)(function () { - var t = gt[c.current++]; + var t = gt[c.current]; rt.show({ - anchor: l, + anchor: p, style: { background: '#666', color: '#fff' }, content: r.createElement(vt, null, t), placement: t, }); }, []); - var m = function () { - var t = gt[c.current++]; + var h = function () { + var t = gt[l.current++]; rt.show({ - anchor: l, + anchor: p, style: { background: '#666', color: '#fff' }, content: r.createElement(vt, null, t), placement: t, }), - c.current > 11 && (c.current = 0); + l.current > 11 && (l.current = 0); }; return r.createElement( dt, @@ -881,7 +882,7 @@ { type: 'primary', onClick: function () { - o(!0), c.current++, c.current > 11 && (c.current = 0), d(); + o(!0), c.current++, c.current > 11 && (c.current = 0), m(); }, }, '点我试试' @@ -895,11 +896,11 @@ r.createElement( s.Z, null, - r.createElement(f.Z, { type: 'primary', onClick: m }, '静态调用'), + r.createElement(f.Z, { type: 'primary', onClick: h }, '静态调用'), r.createElement( f.Z, { - ref: p, + ref: d, onClick: function () { rt.hide(); }, @@ -910,9 +911,8 @@ r.createElement( a.Z, { style: { marginTop: 100 } }, - r.createElement('img', { src: ht, ref: l, onClick: m, style: { cursor: 'pointer' } }) - ), - r.createElement('div', { style: { height: '100vh' } }) + r.createElement('img', { src: ht, ref: p, onClick: h, style: { cursor: 'pointer' } }) + ) ) ); } diff --git a/docs/index.html b/docs/index.html index 70032d5..652ba1b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file