Map_ags.vue 1.86 KB
<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
                    },
                    "img": {
                        "type": "raster",
                        "tiles": ["https://services.wzmap.gov.cn/server/rest/services/TDT/YX2017/MapServer/tile/{z}/{y}/{x}?blankTile=false"],
                        "tileSize": 256
                    }
                },
                "layers": [
                //     {
                //     "id": "simple-tiles",
                //     "type": "raster",
                //     "source": "raster-tiles",
                //     "minzoom": 0,
                //     "maxzoom": 22
                // },
                {
                    "id": "img_lyr",
                    "type": "raster",
                    "source": "img",
                    "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>