---
title: "<ScriptMapLibreScaleControl>"
description: "将 MapLibre 的比例尺添加到最近的父级地图。MapLibre 默认将其放置在左下角。"
canonical_url: "https://nuxt-scripts.zhcndoc.com/scripts/maplibre/api/scale-control"
last_updated: "2026-09-23T10:33:14.913Z"
---

将 MapLibre 的比例尺添加到最近的父级地图。MapLibre 默认将其放置在左下角。

```vue
<template>
  <ScriptMapLibreMap map-style="https://tiles.openfreemap.org/styles/liberty" :center="[147.33, -42.88]">
    <ScriptMapLibreScaleControl position="bottom-left" :options="{ unit: 'metric', maxWidth: 120 }" />
  </ScriptMapLibreMap>
</template>
```

`new maplibregl.ScaleControl()`{lang="ts"} 在创建控件时读取一次 `options` 和 `position`。`options.unit` 也会通过 `setUnit()`{lang="ts"} 响应式更新。若要应用其他更改，请更改组件的 `key`。

::script-types{script-key="maplibre" filter="ScriptMapLibreScaleControl"}
::

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
