1.2.1 • Published 8 years ago

vue-comps-modal v1.2.1

Weekly downloads
38
License
MIT
Repository
github
Last release
8 years ago

vue-comps-modal

the best modal you can get.

Demo

Install

npm install --save-dev vue-comps-modal

or include build/bundle.js.

Usage

# in your component
components:
  "modal": require("vue-comps-modal")
# or, when using bundle.js
components:
  "modal": window.vueComps.modal
<button> Open Modal
  <modal>
    Content
  </modal>
</button>

For examples see dev/.

Note, that the modal will be appended to document.body on first opening.

Props

Nametypedefaultdescription
opacityNumber0.5opacity of the overlay
not-dismissableBooleanfalsecan it get closed by click on overlay or ESC?
ignore-parentBooleanfalsewill not set-up click listener on parent
is-openedBooleanfalse(two-way) set to open / close
transitionString"modal"name of a vue transition. Detailed description
parentElementparentElementwhere to listen for open click
z-indexNumber1500minimum zIndex of the overlay, cannot be lower than 1000 (see vue-overlay for specifics)

Events

Namedescription
before-enterwill be called before open animation
after-enterwill be called when opened
before-leavewill be called before close animation
after-leavewill be called when closed
toggled(isOpened:Boolean)emitted when gets opened or closed. Alternative to use two-way is-opened prop

Transition

You can provide a vue transition like this:

Vue.transition("fade",{
  // your transition
})
// or in the instance:
transitions: {
  fade: {
    // your transition
  }
}
// usage:
template: "<modal transition='fade'></modal>"

The background is managed by vue-overlay. See here for an example on how to change its fading function.

Changelog

  • 1.2.0
    added toggled event
    set default transition

  • 1.1.1
    removed usage of $appendTo

  • 1.1.0
    now using vue transitions
    events are renamed after vue transitions

  • 1.0.0
    added z-index prop
    remove close event listening

Development

Clone repository.

npm install
npm run dev

Browse to http://localhost:8080/.

License

Copyright (c) 2016 Paul Pflugradt Licensed under the MIT license.

1.2.1

8 years ago

1.2.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago