Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change polygon useEffect #152

Merged
merged 1 commit into from
Jun 22, 2021
Merged

Conversation

glintoo
Copy link
Contributor

@glintoo glintoo commented Jun 22, 2021

当我清空list数据时,list.map 绘制的无法删除

@jaywcjlove jaywcjlove merged commit e4352b2 into uiwjs:master Jun 22, 2021
@jaywcjlove
Copy link
Member

useEffect(() => {
if (path && polygon) {
const points = path.map((item) => new BMap.Point(item.lng, item.lat));
polygon.setPath(points);
}
}, [polygon, path]);

polygon.setPath 不起作用?
@glintoo

jaywcjlove added a commit that referenced this pull request Jun 22, 2021
@jaywcjlove
Copy link
Member

Upgrade @uiw/react-baidu-map@1.18.16 @glintoo

@glintoo
Copy link
Contributor Author

glintoo commented Jun 22, 2021

生效了的,主要是没清除原来的覆盖层。
加的这段
return function () {
map.removeOverlay(instance);
};
是从useMarker.ts里拷贝过来的。用来清除之前的覆盖层的。

@jaywcjlove
Copy link
Member

@glintoo 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants