mapPluginsmarkerremoveMarkerid; geometriesvalue = mapPluginsmarkergeometries;上面这段代码怎么使removeMarker函数执行后再赋值
可以使用Promise或者回调函数来实现。
使用Promise:
mapPlugins.marker.removeMarker(id).then(() => {
geometries.value = mapPlugins.marker.geometries;
});
使用回调函数:
mapPlugins.marker.removeMarker(id, () => {
geometries.value = mapPlugins.marker.geometries;
});
在removeMarker函数中加入回调函数参数:
removeMarker(id, callback) {
// ...
if (callback) {
callback();
}
}
原文地址: https://www.cveoy.top/t/topic/brC5 著作权归作者所有。请勿转载和采集!