error TypeError: mars3d.layer.EchartsLayer is not a constructor at createEchartsLayer

使用官方文档内容时:
  const echartsLayer = new mars3d.layer.EchartsLayer(options);
  console.log("echartsLayer", echartsLayer);
  map.addLayer(echartsLayer);
报错:error TypeError: mars3d.layer.EchartsLayer is not a constructor     at createEchartsLayer
需要安装以下内容和引入:

import * as echarts from "echarts";
import * as mars3d from "mars3d";
import "mars3d-echarts";


安装:npm install echarts mars3d mars3d-echarts



其余部分看官方文档
https://mars3d.cn/editor-vue.html?key=ex_10_5_4&id=layer-other/echarts/lines-hanban
https://mars3d.cn/api/EchartsLayer.html
posted @ 2025-11-27 14:09  sinceForever  阅读(5)  评论(0)    收藏  举报