map-component-library
v1.0.0
Published
React component for Baidu Map GL: click map to plan driving routes (react-bmapgl).
Maintainers
Readme
map-component-library
A reusable React component library for Baidu map route planning.
Install
npm install map-component-library react react-dom react-bmapglUsage
import { MapView } from 'map-component-library';
export default function App() {
return (
<MapView
ak="YOUR_BAIDU_MAP_AK"
title="我的路线规划"
startPoint={{ lng: 116.402544, lat: 39.928216 }}
onRouteChange={(route) => console.log(route)}
/>
);
}Build
npm run buildThis generates dist/ with ESM, CJS, and type declarations.
Publish to npm
- 在 npm 登录:
npm login - 若包名
map-component-library已被占用,在package.json里改成作用域名,例如"name": "@你的用户名/baidu-route-map" - 发布:
npm publish(公开作用域包需npm publish --access public)
prepublishOnly 会在发布前自动执行 npm run build。
