update doc

This commit is contained in:
hufeixiong
2021-07-13 20:15:38 +08:00
parent 0b6dbb8677
commit 213b776886
6 changed files with 44 additions and 84 deletions

View File

@@ -15,6 +15,10 @@ const ContextMenu = () => {
const handleclick = () => {
unmountContextMenu();
};
const forceUpdate = useState(0)[1];
contextMenuState.forceUpdate = () => {
forceUpdate((pre) => pre + 1);
};
return (
<div
style={{
@@ -42,4 +46,6 @@ contextMenuState.contextMenu = <ContextMenu></ContextMenu>;
所以在点击后需要调用关闭。
同时上面的left和top是右键的位置。
同时上面的left和top是右键的位置。
另外你还需要在组件内增加个强刷赋值给forceUpdate用于在组件移动时进行跟随。