Map_ags.vue 1.53 KB
<!--
 * @Author: jiangbotao
 * @Date: 2019-12-18 01:40:38
 * @LastEditors  : jiangbotao
 * @LastEditTime : 2019-12-28 16:26:24
 * @FilePath: \supermapvue\client\src\components\layers\Map_ags.vue
 -->
<template>
    <div >
        <div id="map"></div>
    </div>
</template>

<script>
import $ from 'jquery';
import mapboxgl from 'mapbox-gl';
import { Logo, MapService } from '@supermap/iclient-mapboxgl';
export default {
    name: 'HelloWorld',

    data () {
        return {
        
        }
    },
    mounted(){ 
        var map = new mapboxgl.Map({
            container: 'map', // container id
            style: {
                "version": 8,
                "sources": {
                    "raster-tiles": {
                        "type": "raster",
                        "tiles": ["https://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}"],
                        "tileSize": 256
                    }
                },
                "layers": [{
                    "id": "simple-tiles",
                    "type": "raster",
                    "source": "raster-tiles",
                    "minzoom": 0,
                    "maxzoom": 22
                }]
            },
            center: [120.86813445410331, 27.82247481387501], // starting position
            zoom: 12 // starting zoom
        });
        map.addControl(new mapboxgl.NavigationControl(), 'top-left');
    }
}
</script>

<style scoped>
#map {
  position: absolute;
  height: 100%;
  width: 100%;
  background-color: white
}
</style>