npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

map-utils-zhy

v1.1.2

Published

高德地图的基础方法二次封装

Readme

map-utils-zhy

示例

<script setup lang="ts">
	import { ref } from 'vue';
	import { MapContainer, MapSearch } from 'map-utils-zhy';
	/**定义数据 */
	const MapUtilsRef = ref();
	/**地图初始化完成 */
	const init = ({ map, MapUtils }: any) => {
		MapUtilsRef.value = MapUtils;
    //标记点
    MapUtilsRef.value.setMarker(112.297428, 37.90923);
    //设置中心点
    MapUtilsRef.value.setCenter(112.297428, 37.90923);
	};
</script>

<template>
	<div>
		<MapContainer @init="init" height="300px" width="400px"></MapContainer>
		<MapSearch :MapUtils="MapUtilsRef" v-if="MapUtilsRef"></MapSearch>
	</div>
</template>

属性

| 参数 | 类型 | 必填 | 默认值 | 说明 | | ------------- | -------------------------| --------- | -----------|----------------------- | | init | function(map, MapUtils) | - | - | 地图初始化回调 | | mapConfig | object | - | - | 地图配置对象 |

mapConfig 属性

| 参数 | 类型 | 必填 | 默认值 | 说明 | | -------------- | -------------------------| --------- | -----------|----------------------- | | loadConfig | object | - | - | 地图首次加载配置对象 | | containerConfig| object | - | - | 地图容器配置对象 |

loadConfig 属性

| 参数 | 类型 | 必填 | 默认值 | 说明 | | -------------- | -------------------------| --------- | -----------|----------------------- | | securityJsCode | string | - | - | 安全密钥 | | key | string | - | - | Web端开发者Key | | version | string | - | 2.0 | 高德JSAPI 的版本 | | plugins | string[] | - | - | 高德插件列表 |

containerConfig 属性

| 参数 | 类型 | 必填 | 默认值 | 说明 | | -------------- | -------------------------| --------- | -----------------------|----------------------- | | id | string | - | map-container | 设置地图容器id | | viewMode | string | - | 3D | 地图模式 | | zoom | number | - | 9 | 初始化地图级别 | | zooms | number[] | - | [2,20] | 级别范围 | | pitch | number[] | - | 10 | 俯仰角度,2D 地图下无效 | | center | number[] | - | [116.397428, 39.90923] | 地图中心点位置 | | zoomEnable | boolean | - | true | 地图缩放,默认值为true | | dragEnable | boolean | - | true | 地图拖拽,默认值为true |

MapUtils 用法

| 参数 | 类型 | 必填 | 默认值 | 说明 | | -------------- | -------------------------| --------- | -----------|----------------------- | | setCenter | function(lon,lat,opt) | - | - | 设置地图中心点 | | getCenter | function() | - | - | 获取地图中心点 | | setMarker | function(lon,lat,opt) | - | - | 设置标记点 | | setSingleClear | function(item) | - | - | 单个清理 | | setClearAllMap | function() | - | - | 清理所有 | | search | function(searchKey) | - | - | 关键字搜索 | | getSearchLnglat| function(name,adcode) | - | - | 选中的详细地址 有location| | getAddr | function(lon,lat) | - | - | 根据经纬度获取详细地址 | | setZoom | function(level) | - | - | 缩放级别 |