MapboxFullscreenControl

View source
全屏控件,点击在全屏与常态间切换地图容器。

简介

MapboxFullscreenControl 提供全屏按钮,点击在全屏与常态间切换地图容器。position 指定停靠角,options.container 可指定进入全屏的目标元素(省略则用地图容器)。

用法

点击右上角按钮切换全屏:

<template>
  <div class="h-115 w-full overflow-hidden rounded-(--ui-radius) border border-default">
    <MapboxMap
      :options="{ style: 'mapbox://styles/mapbox/light-v11', center: [116.39, 39.91], zoom: 10 }"
    >
      <MapboxFullscreenControl position="top-right" />
    </MapboxMap>
  </div>
</template>

API

Props

Prop Default Type
position"top-left" | "top" | "top-right" | "right" | "bottom-right" | "bottom" | "bottom-left" | "left"

控件停靠位置;省略用地图默认位置

optionsmapboxgl.FullscreenControlOptions

FullscreenControl 构造选项

Changelog

No recent changes
Copyright © 2026 - 2026 YiXuan - MIT License