# 十三.MapboxVector

# 1.Mapbox 矢量图

查看代码详情
<template>
    <div ref="map" class="map"></div>
  </template>
  
  <script>
  export default {
    mounted() {
      let {
        Map,
        View,
        layer: { MapboxVector },
      } = ol;
      const map = new Map({
        target: this.$refs.map,
        layers: [
          new MapboxVector({
            styleUrl: "mapbox://styles/mapbox/bright-v9",
            accessToken: mapkeys.mapbox,
          }),
        ],
        view: new View({
          center: [12579156, 3274244],
          zoom: 2,
        }),
      });
    },
  };
  </script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27