vue-amap icon indicating copy to clipboard operation
vue-amap copied to clipboard

'AMap' is not defined. (no-undef)

Open yuweicl opened this issue 6 years ago • 6 comments

请问这个怎么配置: 若 eslint 报错 AMap is undefined 之类的错误。请将 AMap 配置到 .eslintrc 的 globals 中。

yuweicl avatar Jun 29 '18 01:06 yuweicl

您好,您解决没,我也是遇到这个错误,是不是因为SDK版本的问题

chm1781 avatar Jul 13 '18 07:07 chm1781

同问。。。

git-leonzhou avatar Jan 03 '19 03:01 git-leonzhou

同问

eating-noodles avatar Jan 16 '19 02:01 eating-noodles

目前我发现有三个解决办法, 1.通过在.eslintrc.js中配置如下,只要配置一个:

    globals: {
      AMap: true
    },

2.在每一个使用中配置,每一个使用到的都要配置:

// eslint-disable-next-line no-undef
gaodesatellite: new AMap.TileLayer.Satellite()

3.在某一个使用中配置,应该一个文件只需要一次

/* global AMap*/
gaodesatellite: new AMap.TileLayer.Satellite()

即可解决问题

linrong avatar Apr 23 '19 07:04 linrong

目前我发现有三个解决办法, 1.通过在.eslintrc.js中配置如下,只要配置一个:

    globals: {
      AMap: true
    },

2.在每一个使用中配置,每一个使用到的都要配置:

// eslint-disable-next-line no-undef
gaodesatellite: new AMap.TileLayer.Satellite()

3.在某一个使用中配置,应该一个文件只需要一次

/* global AMap*/
gaodesatellite: new AMap.TileLayer.Satellite()

即可解决问题

已解决,感谢

yuweicl avatar Apr 23 '19 08:04 yuweicl

我也碰到了,AMap 死活就是没有编译不过,最后在eslintConfig 中配置 eslintIgnore 把有Amap的页面给跳过就好了 反正就是很坑不说了。

sun-weitao avatar Apr 16 '21 13:04 sun-weitao