Skip to content

Where To

Where To 是一种极其简单的方式,可帮助您找到附近的牛排馆、银行分行、台球俱乐部或您可能正在寻找的任何其他地方——无论您是在巴黎度假还是在自家后院!Protocol Launcher 允许您生成深度链接以在 Where To 中搜索地点和导航到位置。

使用方式

有两种使用此库的方式:

  • 按需导入(On-Demand):从子路径导入支持 tree-shaking,保持较小的打包体积。
  • 完整导入(Full Import):从根包导入更方便,但会包含所有应用模块。

生产构建建议选择按需导入;快速脚本或演示可以使用完整导入。

选择安装方式

按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。

打开应用

On-Demand
ts
import { open } from 'protocol-launcher/whereto'

const url = open()

搜索

On-Demand
ts
import { search } from 'protocol-launcher/whereto'

const url = search({
  search: 'Bars',
})

在指定位置搜索

On-Demand
ts
import { searchAtLocation } from 'protocol-launcher/whereto'

const url = searchAtLocation({
  search: 'Cafe',
  location: { lat: 37.332331, lon: -122.031219 },
})

显示路线

On-Demand
ts
import { showDirections } from 'protocol-launcher/whereto'

const url = showDirections({
  location: { lat: 37.332331, lon: -122.031219 },
  mode: 'car',
})

显示位置

On-Demand
ts
import { showLocation } from 'protocol-launcher/whereto'

const url = showLocation({
  location: { lat: 37.332331, lon: -122.031219 },
  title: 'Apple HQ',
})

显示地点

On-Demand
ts
import { showPlace } from 'protocol-launcher/whereto'

const url = showPlace({
  poi: '7415861409383649399',
})