Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

## mapbox-gl使用问题 #3358

Closed
LOUSANPANG opened this issue Jun 9, 2019 · 3 comments
Closed

## mapbox-gl使用问题 #3358

LOUSANPANG opened this issue Jun 9, 2019 · 3 comments
Assignees

Comments

@LOUSANPANG
Copy link

问题描述

  1. 引用 mapbox-gl 使用时报错信息 _typeof is not defined
  2. 对于 mapbox-glvue react 甚至是原生里边都没有问题,地图会正常显示。

复现步骤

  1. 这里展示引入已下载好的 mapbox-gl-js 文件,也使用过 npmmapbox-gl 问题一样。
  2. 引入
        <link rel="stylesheet" href="./map/mapbox-gl.css">
        import Mapboxgl from "../../map/mapbox-gl"
    
  3. 使用
      componentDidMount() {
        console.log(Mapboxgl)
        new Mapboxgl.Map({
          container: "map",
          epsg: "EPSG:3857",
          zoom: 3,
          center: [116.39, 39.91],
          hash: true,
          style:
            "http://vtctest.geo-compass.com/api/v1/map/10001000084/publish?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMyIsImlhdCI6MTU1NjE4MjQwNiwiZXhwIjoxNTU2Nzg3MjA2fQ.3haSYFupHKq-6t2X5_GD45SmG7sKW8LTA46Anj1LcEY"
        })
      }
    
  4.   render() {
          return (
            <View id='map' />
          )
       }
    
  5. 可以打印出来 Mapboxgl ,也渲染成功 html ,但是有些有些东西找不到。
    image

image

  1. 该问题在 https://github.com/mapbox/mapbox-gl-js/issues/3422#event-830865781 中提到过。
  2. 貌似是 babel 编译问题。

期望行为
[地图成功显示]

报错信息
image

系统信息

  • 操作系统: [e.g. macOS 10.14.5]
  • Taro 版本 [e.g. v.1.3.0]
  • Node.js 版本 [e.g. v11.10]
  • 报错平台 [h5]

补充信息

  1. [相关问题 _typeof is not defined]
  https://github.com/mapbox/mapbox-gl-js/issues/3422#event-830865781
  1. 测试过vue、react、原生都没有问题,它们也是同样的代码。
@taro-bot
Copy link

taro-bot bot commented Jun 9, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@luckyadam luckyadam added the H5 label Jun 10, 2019
@taro-bot
Copy link

taro-bot bot commented Jun 10, 2019

CC @Littly

@Mrxpj
Copy link

Mrxpj commented Jan 2, 2020

mapbox/mapbox-gl-js#3422 (comment)

你好,请问你解决了吗,我这里也出现同样的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants