vue 使用ol3Echarts出错not ol map object

0 投票

代码:

  import "ol/ol.css";
  import { Map, View } from "ol";
  import Vector from "ol/source/Vector";
  import { Tile , Vector as VectorLayer } from "ol/layer";
  import ol3Echarts from 'ol3-echarts';
  // 下面代码是初始化地图

      var vectorSource = new Vector(),
        addressMatchService = new ol.supermap.AddressMatchService('url'),
        view = new View({
          center: [4700, -3900],
          zoom: 3,
          projection: 'EPSG:4326',
          multiWorld: false
        });
      map = new Map({
        target: 'map',
        view: view
      });
      var layer = new Tile({
        source: new ol.source.TileSuperMapRest({
          url: 'url',
          wrapX: true
        })
      });
      map.addLayer(layer);
      echartslayer = new ol3Echarts(null, {
        hideOnMoving: true,
        hideOnZooming: true
      });
      echartslayer.appendTo(map);

出现以下错误:

请大神解决一下!

5月 19, 2020 分类:  215次浏览 | 用户: babyn~ (7 分)

1个回答

0 投票
您好,看您的代码里面错误点,比较多,请逐一比较

import { Logo, TileSuperMapRest } from '@supermap/iclient-ol';

import {AddressMatchService} from '@supermap/iclient-common/iServer/AddressMatchService';  import EChartsLayer from 'ol-echarts';

            // let echartslayer = new EChartsLayer(null, {

            //     hideOnMoving: true,

            //     hideOnZooming: true

            // });

            // echartslayer.appendTo(map);
5月 19, 2020 用户: 阳俊林 名扬四海 (3,344 分)
谢谢您!是ECharts依赖引入错了,解决了我的问题!
...