heregisvue
v2.0.9
Published
## 安装 ``` npm install heregisvue ```
Downloads
79
Readme
heregisvue
安装
npm install heregisvue
定义事件总线
import Vue from 'vue'
global.$EventBus = new Vue()
引用
import {
ArcGis,
esriModules,
wktUtils,
LatLon,
Widgets,
Editors,
BaseMapToggle
} from 'heregisvue'
初始化
export default {
mounted(){
this.init()
},
methods:{
async init() {
// 加载默认需要的js
await esriModules.loadModules();
const arcgis = new ArcGis();
arcgis.init({
// arcgis js api 配置,可选, 默认值如下
settings: {
url: 'https://arcgis.ynyc.com/arcgis_js_api/library/4.15/dojo/dojo.js',
css: 'https://arcgis.ynyc.com/arcgis_js_api/library/4.15/esri/themes/light/main.css'
},
// 字体地址,可选, 默认值如下
fontsUrl: 'https://arcgis.ynyc.com/arcgis_js_api/library/4.15/esri/themes/base/icons/fonts',
// 除默认模块外,需要加载的模块,可选
modules: [],
// 视图配置, 可选, 默认值如下
viewOptions: [{
// 视图容器id
container: this.mapId,
views: [
{
viewId: '2d',
viewType: 'MapView',
zoom: 7,
center: [101.9464253310309, 24.913562152358953],
}, {
viewId: '3d',
viewType: 'SceneView',
camera: {
position: [102.7, 25.04]
},
zoom: 17
}
]
}]
});
}
}
}