相关文章推荐
英俊的茴香  ·  豆瓣9.0 夏天就要听“强风吹拂”-腾讯新闻·  6 月前    · 
博学的上铺  ·  房山概況_首都之窗_北京市人民政府門戶網站·  6 月前    · 
强健的围巾  ·  十本非常经典的高品质玄幻小说,推荐喜欢玄幻的 ...·  1 年前    · 
无邪的斑马  ·  公安行政法律式样2012年·  1 年前    · 
任性的青蛙  ·  双笙本尊照片个人资料双笙的真名叫什么家境背景 ...·  2 年前    · 
小百科  ›  Drawer | Element Plus
header
坐怀不乱的金针菇
2 年前
Skip to content
Element Plus Logo
Guide Component Resource

Sponsored by

JSDesign VForm JNPF

Basic

Button

Border

Color

Layout Container

Icon

Layout

Link

Text

2.3.0

Scrollbar

Space

Typography

Configuration

Config Provider

Form

Autocomplete

Cascader

Checkbox

Color Picker

Date Picker

DateTime Picker

Form

Input

Input Number

Radio

Rate

Select

Virtualized Select

Slider

Switch

Time Picker

Time Select

Transfer

Upload

Data

Avatar

Badge

Calendar

Card

Carousel

Collapse

Descriptions

Empty

Image

Infinite Scroll

Pagination

Progress

Result

Skeleton

Table

Virtualized Table

2.2.0

Tag

Timeline

Tree

TreeSelect

2.1.8

Virtualized Tree

Statistic

2.2.30

Navigation

Affix

Backtop

Breadcrumb

Dropdown

Menu

Page Header

Steps

Tabs

Feedback

Alert

Dialog

Drawer

Loading

Message

Message Box

Notification

Popconfirm

Popover

Tooltip

Others

Divider

Drawer #

Sometimes, Dialog does not always satisfy our requirements, let's say you have a massive form, or you need space to display something like terms & conditions , Drawer has almost identical API with Dialog , but it introduces different user experience.

TIP

Since v-model is natively supported for all components, visible.sync has been deprecated, use v-model="visibilityBinding" to control the visibility of the current drawer.

TIP

This component requires the <client-only></client-only> wrap when used in SSR (eg: Nuxt ) and SSG (eg: VitePress ).

Basic Usage #

Callout a temporary drawer, from multiple direction

No Title #

When you no longer need a title, you can remove it from the drawer.

Customized Content #

Like Dialog , Drawer can be used to display a multitude of diverse interactions.

Customized Header #

The header slot can be used to customize the area where the title is displayed. In order to maintain accessibility, use the title attribute in addition to using this slot, or use the titleId slot property to specify which element should be read out as the drawer title.

Nested Drawer #

You can also have multiple layer of Drawer just like Dialog .

TIP

The content inside Drawer should be lazy rendered, which means that the content inside Drawer will not impact the initial render performance, therefore any DOM operation should be performed through ref or after open event emitted.

TIP

Drawer provides an API called destroyOnClose , which is a flag variable that indicates should destroy the children content inside Drawer after Drawer was closed. You can use this API when you need your mounted life cycle to be called every time the Drawer opens.

API #

Attributes #

Name Description Type Default
model-value / v-model Should Drawer be displayed boolean false
append-to-body Controls should Drawer be inserted to DocumentBody Element, nested Drawer must assign this param to true boolean false
lock-scroll whether scroll of body is disabled while Drawer is displayed boolean true
before-close If set, closing procedure will be halted Function —
close-on-click-modal whether the Drawer can be closed by clicking the mask boolean true
close-on-press-escape Indicates whether Drawer can be closed by pressing ESC boolean true
open-delay Time(milliseconds) before open number 0
close-delay Time(milliseconds) before close number 0
custom-class deprecated Extra class names for Drawer string —
destroy-on-close Indicates whether children should be destroyed after Drawer closed boolean false
modal Should show shadowing layer boolean true
direction Drawer's opening direction enum rtl
show-close Should show close button at the top right of Drawer boolean true
size Drawer's size, if Drawer is horizontal mode, it effects the width property, otherwise it effects the height property, when size is number type, it describes the size by unit of pixels; when size is string type, it should be used with x% notation, other wise it will be interpreted to pixel unit number | string 30%
title Drawer's title, can also be set by named slot, detailed descriptions can be found in the slot form string —
withHeader Flag that controls the header section's existance, default to true, when withHeader set to false, both title attribute and title slot won't work boolean true
modal-class Extra class names for shadowing layer string —
z-index set z-index number —
header-aria-level a11y header's aria-level attribute string 2

WARNING

custom-class has been deprecated , and will be removed in 2.3.0 , please use class .

Slots #

Name Description
default Drawer's Content
header Drawer header section; Replacing this removes the title, but does not remove the close button.
title deprecated Works the same as the header slot. Use that instead.
footer Drawer footer Section

Methods #

Name Description
handleClose In order to close Drawer, this method will call before-close .

Events #

Name Description Parameter
open Triggered before Drawer opening animation begins —
opened Triggered after Drawer opening animation ended —
close Triggered before Drawer closing animation begins —
closed Triggered after Drawer closing animation ended —

Source #

Component • Docs

Contributors #

JeremyWuuuuu
三咲智子
云游君
btea
0song
opengraphica
Alan Wang
C.Y.Kun
Karolis_Stoncius_Sneakybox
bqy_fe
류한경
Delyan Haralanov
Aex
msidolphin
on the field of hope
zazzaz
Hades-li
liu
Xc
LooSheng
qiang
Edit this page on GitHub
Dialog
Loading

Contents

  • Basic Usage

  • No Title

  • Customized Content

  • Customized Header

  • Nested Drawer

  • Attributes

  • Slots

  • Methods

  • Events

  • Source

  • Contributors

 
推荐文章
英俊的茴香  ·  豆瓣9.0 夏天就要听“强风吹拂”-腾讯新闻
6 月前
博学的上铺  ·  房山概況_首都之窗_北京市人民政府門戶網站
6 月前
强健的围巾  ·  十本非常经典的高品质玄幻小说,推荐喜欢玄幻的读者不要错过!_ ...
1 年前
无邪的斑马  ·  公安行政法律式样2012年
1 年前
任性的青蛙  ·  双笙本尊照片个人资料双笙的真名叫什么家境背景遭扒_游戏花边_ ...
2 年前
今天看啥   ·   Py中国   ·   codingpro   ·   小百科   ·   link之家   ·   卧龙AI搜索
删除内容请联系邮箱 2879853325@qq.com
小百科 - 百科知识指南
© 2024 ~ 沪ICP备11025650号