0.0.4 • Published 7 years ago

dwb-vue-drawer v0.0.4

Weekly downloads
2
License
MIT
Repository
-
Last release
7 years ago

dwb-vue-drawer

npm.io npm.io npm.io npm.io

Install

npm i dwb-vue-drawer --save

Mount

mount with global

import Vue from 'vue'
import Drawer from 'dwb-vue-drawer'

Vue.use(Drawer)

mount with component

import { DwbVueDrawer } from 'dwb-vue-drawer'

export default {
  components: {
    DwbVueDrawer
  }
}

Props

AttributeTypeDefaultDescription
visiblebooleanfalsevisibility of Drawer, supports the .sync modifier
positionstringbottompop-up direction
lockScrollbooleantruewhether scroll of body is disabled while Drawer is displayed
maskClosablebooleantruewhether hide the component when clicked the mask layer
zIndexnumber100the value of the style z-index
maskStyleobject-custom style of mask
containerStyleobject-container style of container

Events

AttributeValueDescription
open-drawer open callback
close-drawer close callback

Methods

AttributeValueDescription
open-open method
close-close method

Demo

<template>
    <DwbVueDrawer :visible.sync="visible"
            :position="position"
            :lockScroll="lockScroll"
            :maskClosable="maskClosable"
            :zIndex="zIndex"
            :maskStyle="maskStyle"
            :containerStyle="containerStyle"
            @open="open"
            @close="close">
      <ul>
        <li>111</li>
        <li>222</li>
        <li>333</li>
      </ul>
    </DwbVueDrawer>
</template>
<script>
export default {
  data () {
    return {
      visible: false,
      position: 'bottom',
      lockScroll: true,
      maskClosable: true,
      zIndex: 200,
      maskStyle: {
        backgroundColor: 'rgba(0, 0, 0, 0.7)'
      },
      containerStyle: {
        background: '#F5F5F5'
      }
    }
  },
  methods: {
    show (position) {
      this.position = position
      this.visible = true
    },
    open () {
      console.log('open callback')
    },
    close () {
      console.log('close callback')
    }
  }
}
</script>

Example

npm install

npm run dev

[Dwb Vue Drawer]

Author

[Dengwb]

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago