谷歌地图 JavaScript 标记与标签
说明
库为Markers提供Google地图平台的标签.
说明: 此库是和已存在的库几乎相同的接口
@google/markerwithlabel,但重新命名并存放在自己的仓库中。 所有未来的发展都将继续在这里进行.
说明: 从
@google/markerwithlabel包括锚地位置。 这应该被认为是一个大版本的起伏!
安装
通过 npm 作为软件包可用 @ googlemaps/ 用标签标记。 。 。 .
npm i @googlemaps/markerwithlabel
或者说
yarn add @googlemaps/markerwithlabel
或者您可以使用 unpkg 链接将 umd 软件包直接添加到 html 文档中 .
<script src="https://unpkg.com/@googlemaps/markerwithlabel/dist/index.min.js"></script>
在通过 unpkg 添加时,标签的标记可以在 new markerWithLabel.MarkerWithLabel()。 。 。 .
一个版本可以通过使用 https://unpkg.com/@googlemaps/markerwithlabel@VERSION/dist/...。 。 。 .
文档
参考文件见此 链接。 。 。 .
示例
import { MarkerWithLabel } from '@googlemaps/markerwithlabel';
new MarkerWithLabel({
position: new google.maps.LatLng(49.475, -123.84),
clickable: true,
draggable: true,
map: map,
labelContent: "foo", // can also be HTMLElement
labelAnchor: new google.maps.Point(-21, 3),
labelClass: "labels", // the CSS class for the label
labelStyle: { opacity: 1.0 },
})
在操作中查看软件包 :
