0.0.28 • Published 4 years ago

vuejs-overlay v0.0.28

Weekly downloads
102
License
MIT
Repository
github
Last release
4 years ago

vuejs-overlay

Travis Build Version Downloads

Vue.js Overlay

Vue.js Overlay is a practical, modern and convenient overlay (popup) Vue.js component.

What?

It is a stylish popup component for Vue.js that you can easily use in your projects.
The most important features are flexible, modern, animated, stable, lightweight.

Install

npm install vuejs-overlay --save

Usage

<div id="app">
    <overlay :opened="opened" :visible="visible" @closed="opened = visible = false">
        <span>My popup</span>
    </overlay>
    
    <button @click="opened = visible = true">Open Popup</button>
</div>
// ES6
import Overlay from 'vuejs-overlay';

new Vue({
    el: '#app',
    data() {
        return {
            opened: false,
            visible: false
        }
    },
    components: {
        Overlay
    }
});

Configurations

You can make the configurations with props.

ConfigurationTypeDefaultDescription
animateString, BooleanfalseYou can choose which animation the popup will open and close.
backdropBooleantrueSpecifies whether the popup has a backdrop.
close-on-escapeBooleantrueThis is to close the popup with the escape key.
close-on-cancelBooleantrueThis is to close the popup with the cancel button.
close-by-backdrop-clickBooleantrueThis is to close the popup when the backdrop is clicked.
closeableBooleantrueClosing feature of the popup. You can use it in critical form operations.
openedBooleanfalseSpecifies the popup is opened.
headerString, BooleanfalseUsed to determine the header text of the popup.
visibleBooleanfalseSpecifies that internal elements are loaded of the popup.

Available animate options:

"bounce", "fade", "slide-down", "slide-left", "slide-right", "slide-up", "zoom-in", "zoom-out", false.

<overlay animate="zoom-in" :opened="opened" :visible="visible" @closed="opened = visible = false">
    <div>👍</div>
</overlay>

animate: zoom-in

Usage asynchronously:

Let's take an example of content data with ajax. In this example we used vuejs-ajax library.

<div id="app">
    <overlay :opened="opened" :visible="visible" @closed="onClosed">
        <span v-text="text"></span>
    </overlay>
    
    <button @click="openHandle">Open Popup</button>
</div>
import ajax from "vuejs-ajax";
import {Overlay} from 'vuejs-overlay.js';
Vue.use(ajax);

new Vue({
    el: '#app',
    data() {
        return {
            opened: false,
            visible: false,
            text: null,
        }
    },
    methods: {
        openHandle() {
            this.overlayOpened = true;

            Vue.ajax.get("example.com/my-request-url").then(response => {
                this.text = response.data;
                this.visible = true;
            });
        },
        onClosed() {
            this.opened = false;
            this.visible = false;
        }
    },
    components: {
        Overlay
    }
});

Events

ConfigurationTypeDescription
@closedCallbackTriggers when the popup is closed. We recommend that you use this to ensure stable operation of this component when closing the popup.
@openedCallbackTriggers when the popup is opened.
<overlay :opened="opened" :visible="visible" @closed="opened = visible = false" @opened="someCallback">
    <span>My popup</span>
</overlay>

License

MIT

Copyright (c) 2019 Fatih Koca

0.0.28

4 years ago

0.0.27

4 years ago

0.0.26

4 years ago

0.0.25

4 years ago

0.0.24

4 years ago

0.0.22

4 years ago

0.0.23

4 years ago

0.0.21

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago