---
title: "useScriptMapLibre"
description: "当你需要直接访问 MapLibre 命名空间或正在构建自己的地图组件时，请使用 useScriptMapLibre()。"
canonical_url: "https://nuxt-scripts.zhcndoc.com/scripts/maplibre/api/use-script-maplibre"
last_updated: "2026-08-11T09:33:13.716Z"
---

当你需要直接访问 MapLibre 命名空间或正在构建自己的地图组件时，请使用 `useScriptMapLibre()`。

<script-types filter="useScriptMapLibre" script-key="maplibre">



</script-types>

```ts
const { onLoaded } = useScriptMapLibre()

onLoaded(({ maplibregl }) => {
  const bounds = new maplibregl.LngLatBounds(points)
  // 直接使用 MapLibre API。
})
```
