Skip to content

Elevator

VElevator keeps the index rail synchronized with the group header currently crossing the content viewport. Reaching the bottom activates the final group, while index clicks scroll only the component list and never move the browser document.

Demo

Elevator 跨端示例与演示

Service cityChoose where the service is available
Selected:Hangzhou
A
B
C
D
F
G
H
J

Basic Usage

vue
<script setup lang="ts">
import { VElevator } from '@varo-ui/h5'
import { ref } from 'vue'

const activeIndex = ref('A')
const indexes = [
  { title: 'A', items: ['Austin', 'Atlanta', 'Albany'] },
  { title: 'B', items: ['Boston', 'Berkeley', 'Boulder'] },
  { title: 'C', items: ['Chicago', 'Cambridge', 'Cleveland'] }
]
</script>

<template>
  <VElevator v-model:active-index="activeIndex" :indexes="indexes" />
</template>

Scroll synchronization

  • activeIndex updates when a group heading crosses the content container top.
  • Reaching the bottom activates the last index so short final groups do not stay unreachable.
  • Clicking the index rail updates state immediately and smooth-scrolls only the internal content container.

Props

PropTypeDefaultDescription
activeIndexstringundefinedActive index
defaultActiveIndexstringundefinedDefault uncontrolled index
indexesElevatorGroup[][]Indexed groups

Events

EventPayloadDescription
update:activeIndexstringActive index changed
changestringActive index changed
clickItem(item, index)Group item clicked