🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@uiw/react-amap-api-loader

Package Overview
Dependencies
Maintainers
2
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uiw/react-amap-api-loader

用于加载高德地图 SDK 依赖,加载完成,全局将会有 **`window.AMap`** 对象。

4.0.3
Source
npm
Version published
Weekly downloads
501
21.31%
Maintainers
2
Weekly downloads
 
Created
Source

APILoader

用于加载高德地图 SDK 依赖,加载完成,全局将会有 window.AMap 对象。

import { APILoader } from '@uiw/react-amap';
// 或者单独安装使用
import { APILoader } from '@uiw/react-amap-api-loader';

基本用法

Map 的父组件必须具有宽度和高度;

import React from 'react';
import { Map, APILoader } from '@uiw/react-amap';

const Demo = () => (
  <APILoader akay="a7a90e05a37d3f6bf76d4a9032fc9129">
    <Map style={{ height: 300 }}/>
  </APILoader>
);

export default Demo

多个地图

import React from 'react';
import ReactDOM from 'react-dom';
import { Map, APILoader } from '@uiw/react-amap';

const Demo = () => (
  <APILoader akay="a7a90e05a37d3f6bf76d4a9032fc9129">
    <Map style={{ height: 100, marginBottom: 10 }} />
    <div style={{ border: '1px solid red' }}>
      <Map style={{ height: 100 }} />
    </div>
  </APILoader>
);

export default Demo

Props

参数说明类型默认值
akay必填 您需先申请密钥(ak)才可使用该服务。⚠️ 注意申请 Web端(JS API)string-
versionSDK 版本string2.0
protocol协议,默认是根据当前网站协议的http/httpswindow.location.protocol
hostAndPath请求 SDK 的前半部分stringwebapi.amap.com/maps
callbackName回调函数stringload_amap_sdk
plugin加载一个或者多个插件 AMap.ToolBar,AMap.Drivingstring-

Keywords

react-amap

FAQs

Package last updated on 17 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts