@lassehaslev/vue-modal
Simple Modal logic with vue
Last updated 2 years ago by lassehaslev .
Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @lassehaslev/vue-modal 
SYNC missed versions from official npm registry.

@lassehaslev/vue-modal

Simple Modal logic with Vue2

Installation

Run npm install @lassehaslev/vue-modal --save in your project folder

Usage

Use this simple modal with Bulma.

import { Modal } from '@lassehaslev/vue-modal';
export default {
    template: `
        <a @click="open" class="button is-primary is-large" href="#">Open a simple modal</a>
        <modal ref="modal">
            <!-- Modal content Start -->
            <div class="box has-text-centered">
                <h1 class="title">
                    First modal
                </h1>
            </div>
            <!-- Modal content END -->
        </modal>
    `,
    methods: {
        open() {
            this.$refs.modal.open();
        }
    },
    components: {
        Modal,
    }
}

Extend / Build your own!

Just include the BaseModal class as a mixin, and you are good to call open and close and checking isShowingModal boolean.

import BaseModal from '@lassehaslev/vue-modal';

export default {
    template: `
    <div v-show="isShowingModal" class="modal is-active">
        <div class="modal-background" @click="close"></div>
        <div class="modal-content">
            <slot></slot>
        </div>
        <button class="modal-close" @click="close"></button>
    </div>
    `,

    mixins: [ BaseModal ],
}

Development

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

For detailed explanation on how things work, consult the docs for vue-loader.

Current Tags

  • 3.1.1                                ...           latest (2 years ago)

6 Versions

  • 3.1.1                                ...           2 years ago
  • 3.1.0                                ...           2 years ago
  • 3.0.0                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 37
Dependencies (1)
Dev Dependencies (11)

Copyright 2014 - 2018 © taobao.org |