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 🙏

© 2025 – Pkg Stats / Ryan Hefner

qqmap-uniapp

v1.0.0

Published

腾讯地图QQMap SDK的ESM版本,适配uni-app与现代构建环境。

Readme

QQMap uni-app JavaScript SDK - ESM Version

腾讯位置服务 uni-app JavaScript SDK的ES模块版本,专为现代JavaScript开发环境设计。

简介

腾讯位置服务为uni-app提供了基础的标点能力、线和圆的绘制接口等地图组件,以及位置展示、地图选点等地图API位置服务能力支持。在此基础上,腾讯位置服务 uni-app JavaScript SDK是专为uni-app开发者提供的LBS数据服务工具包,开发者可以在uni-app中调用腾讯位置服务的POI检索、关键词输入提示、地址解析、逆地址解析、行政区划和距离计算等数据服务。

安装

npm install qqmap-uniapp

使用说明

本包基于腾讯官方发布的v1.2版本进行ES模块(ESM)格式转换,支持现代JavaScript开发环境。调用文档参照腾讯位置服务官方文档

快速开始

1. 申请开发者密钥(key)

请前往腾讯位置服务控制台申请您的开发者密钥。

2. 开通 WebServiceAPI 服务

在控制台的"应用管理"中,添加新的 key,并勾选 WebServiceAPI 权限,然后保存。

3. 配置安全域名

小程序管理后台的"开发" -> "开发管理" -> "开发设置" -> "服务器域名"中,设置 request 合法域名,添加 https://apis.map.qq.com

4. 使用示例

微信小程序中使用

// 引入 SDK 核心类
import QQMapWX from 'qqmap-uniapp';

Page({
  onLoad() {
    // 实例化 API 核心类
    this.qqmapsdk = new QQMapWX({
      key: '您的开发者密钥'
    });
  },
  
  onShow() {
    // 调用接口
    this.qqmapsdk.search({
      keyword: '酒店',
      success(res) {
        console.log(res);
      },
      fail(res) {
        console.log(res);
      },
      complete(res) {
        console.log(res);
      }
    });
  }
});

API 接口

构造函数

new QQMapWX(options)

参数说明:

| 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | options | Object | 是 | 配置参数 | | options.key | String | 是 | 开发者密钥 |

核心类方法

| 方法 | 返回值 | 说明 | 官方文档 | |------|--------|------|----------| | search(options:Object) | none | 地点搜索,搜索周边poi,比如:"酒店" "餐饮" "娱乐" "学校" 等等 | 查看详情 | | getSuggestion(options:Object) | none | 用于获取输入关键字的补完与提示,帮助用户快速输入 | 查看详情 | | reverseGeocoder(options:Object) | none | 提供由坐标到坐标所在位置的文字描述的转换。输入坐标返回地理位置信息和附近poi列表 | 查看详情 | | geocoder(options:Object) | none | 提供由地址描述到所述位置坐标的转换,与逆地址解析的过程正好相反 | 查看详情 | | direction(options:Object) | none | 提供驾车,步行,骑行,公交的路线规划能力 | 查看详情 | | getCityList() | none | 获取全国城市列表数据 | 查看详情 | | getDistrictByCityId(options:Object) | none | 通过城市ID返回城市下的区县 | 查看详情 | | calculateDistance(options:Object) | none | 计算一个点到多点的步行、驾车距离 | 查看详情 |

方法options参数通用属性

options中可以指定success, fail, complete来接收接口调用结果,调用结果状态码见下表,具体结果数据见各方法详细描述页面。

| 属性 | 类型 | 必填 | 说明 | |------|------|------|------| | success | Function | 否 | 接口调用成功的回调函数 | | fail | Function | 否 | 接口调用失败的回调函数 | | complete | Function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |

调用结果状态码

| status | message | |--------|---------| | 0 | 正常 | | 310 | 请求参数信息有误 | | 311 | key格式错误 | | 306 | 请求有护持信息请检查字符串 | | 110 | 请求来源未被授权 | | 1000 | 小程序内部抛出的错误 |

与原始版本的区别

本ESM版本与原始CommonJS版本的主要区别:

  1. 模块格式:使用ES模块格式,支持import语法
  2. 默认导出QQMapWX类作为默认导出
  3. 兼容性:保持与原版API完全一致

许可证

MIT License

相关链接