본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Elevator

원문 보기 위키 갱신

Elevator (엘리베이터 인덱스)

연락처 목록처럼 긴 목록에서 인덱스를 이용해 원하는 위치로 빠르게 이동할 때 쓰는 컴포넌트예요. 오른쪽의 A~Z 인덱스 바를 누르면 해당 섹션으로 바로 이동해요.

출처: 문서

본문

소개 (Intro)

목록을 빠르게 찾아가고 인덱스를 표시하는 데 사용해요.

설치 (Install)

import { createApp } from 'vue'
import { Elevator } from '@nutui/nutui'

const app = createApp()
app.use(Elevator)

데모 (Demos)

아래 항목들은 원문 문서의 대화형 데모로 제공돼요.

  • 기본 사용법 (Basic Usage) — demo: elevator basic
  • 커스텀 인덱스 (Custom index) — demo: elevator custom
  • 상단 고정 (Sticky) — demo: elevator sticky
  • 커스텀 콘텐츠 (Custom Content) — demo: elevator content

API

Props

Attribute Description Type Default
height Height of elevator area number | string 200px
accept-key Index key value string title
index-list Index list Array(item needs to contain id and name attributes, and name supports passing in html structure) [{id: 0, name: ''}]
is-sticky Whether the index is ceiling boolean false
space-height Up and down spacing of right anchor point number 23
title-height Height of left index number 35

Slots

Name Description
default Customize the contents of each data under the left index

Events

Event Description Arguments
click-item Click content key: string, item: { id: 0, name: '' }
click-index Click index key: string
change Change index index: number

Methods

Name Description Arguments
scrollTo Scroll to the location of the corresponding index index:number

Theming

CSS Variables

The component provides the following CSS variables, which can be used to customize styles. Please refer to ConfigProvider component.

Name Default Value
--nut-elevator-list-item-highcolor var(--nut-primary-color)
--nut-elevator-list-item-font-size 12px
--nut-elevator-list-item-font-color #333333
--nut-elevator-list-item-name-padding 0 20px
--nut-elevator-list-item-name-height 30px
--nut-elevator-list-item-name-line-height 30px
--nut-elevator-list-item-code-font-size 14px
--nut-elevator-list-item-code-font-color #1a1a1a
--nut-elevator-list-item-code-font-weight 500
--nut-elevator-list-item-code-padding 0 20px
--nut-elevator-list-item-code-height 35px
--nut-elevator-list-item-code-line-height 35px
--nut-elevator-list-item-code-after-width 100%
--nut-elevator-list-item-code-after-height 1px
--nut-elevator-list-item-code-after-bg-color #f5f5f5
--nut-elevator-list-item-code-current-box-shadow 0 3px 3px 1px rgba(240, 240, 240, 1)
--nut-elevator-list-item-code-current-bg-color #fff
--nut-elevator-list-item-code-current-border-radius 50%
--nut-elevator-list-item-code-current-width 45px
--nut-elevator-list-item-code-current-height 45px
--nut-elevator-list-item-code-current-line-height 45px
--nut-elevator-list-item-code-current-position absolute
--nut-elevator-list-item-code-current-right 60px
--nut-elevator-list-item-code-current-top 50%
--nut-elevator-list-item-code-current-transform translateY(-50%)
--nut-elevator-list-item-code-current-text-align center
--nut-elevator-list-item-bars-position absolute
--nut-elevator-list-item-bars-right 8px
--nut-elevator-list-item-bars-top 50%
--nut-elevator-list-item-bars-transform translateY(-50%)
--nut-elevator-list-item-bars-padding 15px 0
--nut-elevator-list-item-bars-background-color #eeeff2
--nut-elevator-list-item-bars-border-radius 6px
--nut-elevator-list-item-bars-text-align center
--nut-elevator-list-item-bars-z-index 1
--nut-elevator-list-item-bars-inner-item-padding 3px
--nut-elevator-list-item-bars-inner-item-font-size 10px
--nut-elevator-list-fixed-color var(--nut-primary-color)
--nut-elevator-list-fixed-bg-color var(--nut-white)
--nut-elevator-list-fixed-box-shadow 0 0 10px #eee
--nut-elevator-list-item-bars-inner-item-active-color var(--nut-primary-color)

더 알아보기 (Learn more)