Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A simple DrawerLayout component for Vue.js.

License

NotificationsYou must be signed in to change notification settings

hjl19911127/vue-drawer-layout

Repository files navigation

npmnpmtravisnpmnpm

A simple DrawerLayout component forVue.js

中文文档

Demo

http://share.codehuang.com/vue-drawer-layout

Mobile QQ by Alexander Huang(click me or scan the qrcode)

Try it

Click the avatar at the top-left or touch(click) and drag to right(left).

Demo

If the image is not animating, maybe your browser does not supportsAPNG, you could turn to theGIF demo.

Dependencies

Browser Support

Modern (mobile) browsers and Internet Explorer 10+(due to CSS transition support) and X5 core is supported.

Installation

npm install vue-drawer-layout --save

Usage

The following examples can also be used with CommonJS by replacing ES6-specific syntax with CommonJS equivalents.

importVuefrom'vue'importDrawerLayoutfrom'vue-drawer-layout'Vue.use(DrawerLayout)// orimport{DrawerLayout}from'vue-drawer-layout'Vue.component(DrawerLayout.name,DrawerLayout)

You can easily just set nothing or onlydrawer-width prop to get a simple drawer.It act above the main content.

<vue-drawer-layoutref="drawer":drawer-width="800"><divclass="drawer-content"slot="drawer"><!-- drawer-content --></div><divslot="content"><!-- main-content --></div></vue-drawer-layout>

Or you can set every prop as you want to get a fantastic drawer like mobile QQ has(It act below the main content and with distance is 1/3 of the main content drag).

<vue-drawer-layoutref="drawer":drawer-width="800":enable="true":animatable="true":z-index="0":drawable-distance="Math.floor(800/3)":content-drawable="true":backdrop="true":backdrop-opacity-range="[0,0.4]"@slide-start="handleSlideStart"@slide-move="handleSlideMove"@slide-end="handleSlideEnd"@mask-click="handleMaskClick"><divclass="drawer-content"slot="drawer"><!-- drawer-content --></div><divslot="content"><!-- main-content --></div></vue-drawer-layout>

API

Props

NameInfoTypeDefault
drawer-widthwidth of drawer(px)Number80% of the container(parentNode) width
drawable-distancefarthest distance to draw(px)Numbersame asdrawer-width prop
z-indexz-index of drawerNumber818(Don't Ask^_^)
content-drawablewhether to make content-wrapper drawableBooleanfalse
backdropwhether to show backdropBooleantrue
backdrop-opacity-rangethe opacity range of backdrop[min,max]Array[0,0.4]
enableis drawer enableBooleantrue
animatableis drawer animate during movingBooleantrue
reverseis drawer slide out from rightBooleanfalse

Slots

NameInfo
drawercontent in drawer-content
contentcontent in main-content

Methods

NameInfoArgumentsUsage
togglemethod to show and hide drawervisible(Boolean)toggle(true/false) ortoggle()to show(hide)

Events

NameInfoCallback Arguments
slide-startdrawer start to slide (fired when touchdown)-
slide-movedrawer sliding (fired when touchmove)pos(int)
slide-enddrawer sliding (fired when touchend or transitionend)visible(boolean)
mask-clicktouch(click) on mask-

License

MIT License.

Copyright (c) 2018 Alexander Huang.


[8]ページ先頭

©2009-2025 Movatter.jp