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

在高德地图作为底图时,设置的主题不生效,发现高德需要传入密钥,不知道是不是因为这个,但是不知道在antv里面如何传入高德密钥 #2290

Closed
HFY-aa opened this issue Feb 9, 2024 · 3 comments
Assignees
Labels

Comments

@HFY-aa
Copy link

HFY-aa commented Feb 9, 2024

  • L7 Version:
  • Platform:
  • Mini Showcase(like screenshots):
  • CodePen Link:
Copy link
Contributor

github-actions bot commented Feb 9, 2024

hi @HFY-aa, welcome!

@github-actions github-actions bot added good first issue Good for newcomers 🌟 star labels Feb 9, 2024
Copy link
Contributor

github-actions bot commented Feb 9, 2024

Hi @HFY-aa, Please star this repo if you find it useful! Thanks ⭐!
你好 @HFY-aa。如果该仓库对你有用,可以 star 一下,感谢你的 ⭐!

@foxii-cn
Copy link

参见 JS API 安全密钥使用

Vue组合式API+TypeScript示例

const scene = shallowRef<Scene>()
onMounted(() => {
  scene.value = new L7.Scene({
    id: 'map',
    map: new GaodeMap({
      pitch: 0,
      zoom: 14,
      token: '[Key]',                     // 这
    }),
  })
})
useMapSecurityConfig()
declare const window: {
  _AMapSecurityConfig?: {
    serviceHost?: string         // 代理服务器转发
    securityJsCode?: string      // 明文方式
  }
} & Window
function useMapSecurityConfig() {
  window._AMapSecurityConfig = {
    securityJsCode: '[安全密钥]',         // 和这
  } as const
  onScopeDispose(() => delete window._AMapSecurityConfig)
}

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

No branches or pull requests

3 participants