esriLoaderAPI.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * @Author: tengmingxue 1473375109@qq.com
  3. * @Date: 2022-11-10 13:28:12
  4. * @LastEditors: tengmingxue 1473375109@qq.com
  5. * @LastEditTime: 2022-11-10 14:55:07
  6. * @FilePath: \mbBigScreen\src\views\dashboard\components\mapdata\esriLoaderAPI.js
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. */
  9. import esriLoader from 'esri-loader'
  10. import { loadModules } from 'esri-loader'
  11. import { esriConfig } from 'staticPub/config' // 查找静态文件下的config 地图配置
  12. // window.apiRoot = 'https://js.arcgis.com/4.17/'; //可以写在项目的配置文件里
  13. window.apiRoot=esriConfig.baseUrl
  14. //可以写在项目的配置文件里
  15. window.dojoConfig = {
  16. async: true,
  17. // for jsapi ver. >= 4.9 兼容浏览器
  18. deps: ['@dojo/framework/shim/main'],
  19. // for jsapi ver. <= 4.8
  20. // deps: ['@dojo/shim/main'],
  21. packages: [
  22. // {
  23. // name: 'sample',
  24. // location: 'sample/demo'
  25. // },
  26. ],
  27. has: {
  28. 'esri-promise-compatibility': 1, // Use native Promises by default
  29. 'esri-featurelayer-webgl': 1, // Enable FeatureLayer WebGL capabilities
  30. }
  31. };
  32. function configEsriLoader() {
  33. esriLoader.utils.Promise = Promise;
  34. }
  35. export function load(modules) {
  36. //configEsriLoader(); esri-loader 2.16.0 之前版本用这个
  37. return loadModules(modules, {
  38. dojoConfig: window.dojoConfig,
  39. url: window.apiRoot,
  40. });
  41. }