Skip to content

Layer Control

Usecase

  • Provide a comprehensive layer management interface for datasets and layers.
  • Allow users to create, group, reorder, and delete layers dynamically.
  • Support drag-and-drop functionality for layer organization.
  • Integrate with dataset management system for seamless layer operations.

Props

PropDescriptionTypeRequiredDefault Value
mapIdstringfalse--
dragIdstringfalse--
btnWidthnumberfalse40
position'top-left', 'top-right', 'bottom-left', 'bottom-right'false'bottom-right'
controlVisiblebooleanfalsetrue

and

PropDescriptionTypeRequiredDefault Value
disabledCreateDisable create layer buttonbooleanfalsefalse
disabledCreateGroupDisable create group buttonbooleanfalsefalse
disabledDeleteAllDisable delete all buttonbooleanfalsefalse

Slots

NameDescriptionProps
titleListCustom content for title area{ mapId: string }
endListContent at the end of list{ mapId: string }
defaultDefault slot content-

Events

This component does not emit custom events. It integrates with the dataset management system through the store.

Usage

vue
<script setup lang="ts">
import { Map } from '@hungpvq/vue-map-core';
import { LayerControl } from '@hungpvq/vue-map-dataset';
import '@hungpvq/vue-map-core/style.css';
import '@hungpvq/vue-map-dataset/style.css';
</script>

<template>
  <Map>
    <LayerControl position="top-left" :disabledCreate="false" :disabledCreateGroup="false" :disabledDeleteAll="false" />
  </Map>
</template>

With Custom Slots

vue
<template>
  <Map>
    <LayerControl position="top-left">
      <template #titleList="{ mapId }">
        <button @click="addCustomLayer">Add Custom Layer</button>
      </template>
      <template #endList="{ mapId }">
        <BaseMapCard :mapId="mapId" />
      </template>
    </LayerControl>
  </Map>
</template>

With Basemap Integration

vue
<template>
  <Map>
    <LayerControl position="top-left">
      <template #endList="{ mapId }">
        <BaseMapCard :mapId="mapId" />
      </template>
    </LayerControl>
  </Map>
</template>

<script setup lang="ts">
import { Map } from '@hungpvq/vue-map-core';
import { LayerControl } from '@hungpvq/vue-map-dataset';
import { BaseMapCard } from '@hungpvq/vue-map-basemap';
</script>