example-es6.html 838 B

123456789101112131415161718192021222324252627282930313233343536
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  7. <title>JSAPI Loader - ES6</title>
  8. <style>
  9. html, body, #container {
  10. height: 100%;
  11. width: 100%;
  12. margin: 0;
  13. }
  14. </style>
  15. </head>
  16. <body>
  17. <div id="container" tabindex="0"></div>
  18. <script type="module">
  19. import AMapLoader from '../src/index.js';
  20. AMapLoader.load({
  21. key:'',//必填
  22. version:'2.0',
  23. plugins:['AMap.Scale']
  24. }).then((AMap)=>{
  25. debugger
  26. var map = new AMap.Map('container');
  27. map.addControl(new AMap.Scale())
  28. }).catch((e)=>{
  29. console.error(e);
  30. });
  31. </script>
  32. </script>
  33. </body>
  34. </html>