Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
@uiw/react-baidu-map-api-loader
Advanced tools
Baidu Map api-loader Components for React.
Weekly downloads
Readme
用于加载百度地图 SDK 依赖,加载完成,全局将会有 window.BMap
对象。
import { APILoader } from '@uiw/react-baidu-map';
// 或者单独安装使用
import APILoader from '@uiw/react-baidu-map-api-loader';
Map 的父组件必须具有宽度和高度;
🚧 注意:如果你不使用
APILoader
组件,需要手动将 SDK 引入到 HTML 中。
<script
type="text/javascript"
src="http://api.map.baidu.com/api?v=3.0&ak=eYpCTECSntZmw0WyoQ7zFpCRR9cpgHFG&callback=load_bmap_sdk"
>
</script>
import React from 'react';
import { Map, APILoader } from '@uiw/react-baidu-map';
const Demo = () => (
<div style={{ width: '100%' }}>
<APILoader akay="eYpCTECSntZmw0WyoQ7zFpCRR9cpgHFG">
<Map autoLocalCity style={{ height: 350 }} />
</APILoader>
</div>
);
export default Demo;
收到一个需求,希望自己在 html
中引入 SDK,不需要自动加载,可以使用 disableScripts
禁用,在 html 中自己手动添加
<APILoader disableScripts>
<Map style={{ height: 100, marginBottom: 10 }} />
</APILoader>
<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=您的密钥"></script>
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
akay | 必填 disableScripts=true 时选填 您需先申请密钥(ak)才可使用该服务,接口无使用次数限制,请开发者放心使用。 | string | - |
version | SDK 版本 | string | 3.0 |
protocol | 协议,默认是根据当前网站协议的 | http /https | window.location.protocol |
hostAndPath | 请求 SDK 的前半部分 | string | api.map.baidu.com/api |
type | 可选使用百度的 webgl 地图 | webgl | - |
disableScripts | 禁用 SDK 加载 | boolean | - |
FAQs
Baidu Map api-loader Components for React.
The npm package @uiw/react-baidu-map-api-loader receives a total of 910 weekly downloads. As such, @uiw/react-baidu-map-api-loader popularity was classified as not popular.
We found that @uiw/react-baidu-map-api-loader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.