1.0.1 • Published 5 years ago

vue-drawer-plugin v1.0.1

Weekly downloads
7
License
MIT
Repository
github
Last release
5 years ago

Vue-Drawer-Plugin

A panel which slides in from the edge of the screen.

codecov vuejs version Liscense Build Status PRs Welcome

When To Use

A Drawer is a panel that is typically overlaid on top of a page and slides in from the side. It contains a set of information or actions. Since the user can interact with the Drawer without leaving the current page, tasks can be achieved more efficiently within the same context.

  • Use a Form to create or edit a set of information.

  • Processing subtasks. When subtasks are too heavy for a Popover and we still want to keep the subtasks in the context of the main task, Drawer comes very handy.

  • When the same Form is needed in multiple places.

API

PropsDescriptionTypeDefault
showCloseWhether a close (x) button is visible on top right of the Drawer dialog or not.Booleantrue
showHeaderWhether a header container is visible on top of the Drawer dialog or not, which you can set the title.Booleantrue
titleYou can set the title if showHeader is true.String-
maskWhether to show mask or not.Booleantrue
maskCloseableClicking on the mask (area outside the Drawer) to close the Drawer or not.Booleantrue
maskStyleStyle of Drawer's mask element.Object-
wrapStyleStyle of Drawer wrapper.Object-
bodyStyleStyle of floating layer, typically used for adjusting its position.Object-
visibleWhether the Drawer dialog is visible or not.Booleanfalse
widthWidth of the Drawer dialog.String | Number256
heightPlacement is top or bottom, height of the Drawer dialog.String | Number256
classNameThe class name of the container of the Drawer dialog.String-
zIndexThe z-index of the Drawer.Number1000
placementThe placement of the Drawer.String'right'
close-on-press-escapeWhether the dialog can be closed by pressing ESC.booleantrue
before-closeCallback before Drawer Dialog close, and it will prevent Dialog from closing.function(done),done is used to close the Drawer Dialog-

How to use

Install

npm install vue-drawer-plugin -S

// or

yarn add vue-drawer-plugin

Demo

Quick Start

import vueDrawer from 'vue-drawer-plugin';

Vue.use(vueDrawer);
// single-component.vue
<template>
    <vue-drawer
        :visible.sync="visible"
        class="test-wrap-class"
        title="header"
        width="70vw"
        height="200px"
        @opened="opened"
        :before-close="handleClose"
        @close="closeRightNow"
        @closed="closed"
        :wrap-style="{ border: '1px solid #ddd' }"
        :body-style="{ background: '#ddd' }"
        :mask-closeable="true"
        :show-close="true"
    >
    <div>This is content inside Drawer dialog</div>
    <button @click="openAnother">feel free to open another Drawer inside your Drawer</button>
</vue-drawer>
</template>

Browser Support

Modern browsers and Internet Explorer 10+.

IE / EdgeFirefoxChromeSafariOperaElectron
IE10, IE11, Edgelast 2 versionslast 2 versionslast 2 versionslast 2 versionslast 2 versions

Development

Skip this part if you just want to use vue-drawer-plugin.

For those who are interested in contributing to this plugin, you can submit pull request or just download this repository and run.

License

vue-drawer-plugin is released under the MIT License.

1.0.1

5 years ago

1.0.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago