首页 > 其他 > 详细

arcGis引入vue中

时间:2021-05-14 15:28:10      阅读:8      评论:0      收藏:0      [点我收藏+]

首先创建vue-cli的脚手架

1.npm i -globa vue-cli

2.vue init webpack

3.选择创建自己的vue项目

4.npm install --save esri-loader(very important)

5.在hellowword.vue文件中引入具体代码如下

<template>
<div class="fx"></div>

</template>

<script>
import { loadModules } from ‘esri-loader‘;

export default {
  name: ‘web-map‘,
  mounted() {
    loadModules([‘esri/Map‘, ‘esri/views/MapView‘], { css: true })
    .then(([ArcGISMap, MapView]) => {
      const map = new ArcGISMap({
        basemap: ‘topo-vector‘
      });

      this.view = new MapView({
        container: this.$el,
        map: map,
        center: [-118, 34],
        zoom: 8
      });
    });
  },
  beforeDestroy() {
    if (this.view) {
      this.view.container = null;
    }
  }
};

</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.fx {
  padding: 0;
  margin: 0;
  width: 1920px;
  height: 1080px;
}
</style>

arcGis引入vue中

原文:https://www.cnblogs.com/1229834468wty/p/14767501.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!