author.js 451 B

12345678910111213141516171819
  1. // var request = require("./request.js");
  2. const QQMapWX = require("@/libs/qqmap-wx-jssdk.min.js");
  3. export const key = "CXDBZ-UNALF-Q4SJ7-NCXTF-LVP36-6JFSB"
  4. const wxMap = new QQMapWX({ key });
  5. export function getDistance(from, to, callback) {
  6. wxMap.calculateDistance({
  7. mode: 'straight',
  8. from, to,
  9. success: function (res) {//成功后的回调
  10. callback(res);
  11. },
  12. fail: function (error) {
  13. callback(error);
  14. }
  15. })
  16. }