The issue seems to be with the implementation of the stopScanMap function. The call_back_fun is being called with content as the context, but it should be called with this as the context. Here is the corrected code:

stopScanMap: async function (agvId, call_back_fun) {
  var res = await getAgvModule().stopSlam(agvId, function(res, content) {
    call_back_fun.call(this, content);
  });
  return res;
}

webApi.stopScanMap(25, function (content) {
  console.log('停止扫图', JSON.stringify(content))
});

Now, the call_back_fun function will be called with content as the argument and this as the context, allowing you to access the data correctly.

JavaScript stopScanMap Function: Correcting Callback Context for Accessing Data

原文地址: https://www.cveoy.top/t/topic/qnTF 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录