Skip to content

uniapp 出现 TypeError: (0 , _tslib.__spreadArray) is not a function #2690

@hi-pengyu

Description

@hi-pengyu

### 问题描述

Uncaught (in promise) TypeError: (0 , _tslib.__spreadArray) is not a function
at Device_GL.checkLimits (pages-map-map.js:97325:85)
at new Device_GL (pages-map-map.js:97271:10)
at WebGLDeviceContribution. (pages-map-map.js:98881:31)
at step (pages-map-map.js:58949:23)
at Object.next (pages-map-map.js:58930:53)
at pages-map-map.js:58923:71
at new Promise ()
at __awaiter (pages-map-map.js:58919:12)
at WebGLDeviceContribution.createSwapChain (pages-map-map.js:98859:33)
at DeviceRendererService._callee3$ (pages-map-map.js:44616:43)

重现链接

No response

重现步骤

{
  "dependencies": {
    "@amap/amap-jsapi-loader": "^1.0.1",
    "@antv/l7": "^2.8.41",
    "@antv/l7-draw": "^2.2.37",
    "@antv/l7-maps": "2.8.41",
    "@turf/turf": "6.5.0",
    "tslib": "^1.14.1",
    "typescript": "^4.5.5"
  }
}
<template>
  <div>
    <div :id="mapId" style="height: 100vh; width: 100%; position: relative;"></div>
  </div>
</template>

<script>
import { Scene } from '@antv/l7';
import { GaodeMap } from '@antv/l7-maps';
import { multiPolygonList } from './mock.ts';

// Your existing code using feature, multiPolygon, and polygon

export default {
  name: 'Demo',
  data() {
    return {
      mapId: `map-${Math.random()}`,
      polygonDrawer: null,
      scene: null
    };
  },
  mounted() {
    this.scene = new Scene({
      id: this.mapId,
      map: new GaodeMap({
        center: [120.151634, 30.244831],
        pitch: 0,
        style: 'dark',
        zoom: 10,
        token: '8eefc214b06b5ddbdd2d4917b9f8d9cf',
      }),
      logoVisible: false, //去除logo
    });

    this.scene.on('loaded', () => {
      // 关闭默认 L7 Logo
      const tileLayer = new AMap.TileLayer.Satellite();
      tileLayer.setMap(this.scene.map);
      
      const drawer = new DrawPolygon(this.scene, {
        initialData: multiPolygonList,
        editable: false,
      });
      
      this.polygonDrawer = drawer;
      drawer.disable();

      drawer.on(DrawEvent.Change, console.log);
    });
  },
  beforeDestroy() {
    if (this.polygonDrawer) {
      this.polygonDrawer.disable();
    }
    if (this.scene) {
      this.scene.destroy();
    }
  }
};
</script>

<style>
/* 可以添加全局样式 */
</style>


预期行为

No response

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response``

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions