npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue2-flexible-modal

v0.0.1

Published

a flexible modal component by vue.js

Downloads

34

Readme

vue-flexible-modal

a flexible modal component by vue.js

Live Demo

Installation

First, install vue2-flexible-modal from npm:

$ npm install vue2-flexible-modal

Then import it:

import Modal from 'vue2-flexible-modal';

Usage

Please view the detail code in example folder

<script>
    import Modal from 'vue2-flexible-modal';
    export default {
        components: {
            Modal
        },
        data:{
            modal:{
                title:'I am modal title',
                visible:false,
                text:''
            }
        },
        methods:{
            onShowModal(){
                this.modal.visible = !this.modal.visible;
            },
            MODAL_OK_EVENT(){
                // you can set modal show or hide with the variable 'this.modal.visible' manually
                // this.modal.visible = false;
            },
            MODAL_CANCEL_EVENT(){

            }
        }
    };
</script>
<template>
    <div>
        <button @click="onShowModal">Click Show Modal</button>
        <modal :title="modal.title" v-model="modal.visible" :bg-click="false" :verify="true" @MODAL_OK_EVENT="MODAL_OK_EVENT" @MODAL_CANCEL_EVENT="MODAL_CANCEL_EVENT">
            <p class="control">
                <label class="label">Name:</label>
                <input class="input" type="text" v-model="modal.text" placeholder="Your name">
            </p>
        </modal>
    </div>
</template>

API

| Option | Description | Value | Default | |--------------------|------------------------------------------------------------------|------------------------|----------| | title | Modal Title | String | 'Modal' | | okText | ok button text | String | 'ok' | | cancelText | cancel button text | String | 'cancel' | | visible | control the modal show or hide(primary key) | Boolean | 'false' | | transition | modal show or hide with your custom animation/transition | String | 'bounce' | | verify | if need verify form data when click ok button | Boolean | 'false' | | bgClick | the switch for hiding modal by clicking background | Boolean | 'true' | | onlyBody | hide the modal head and foot,only show body content | Boolean | 'false' | | bgStyle | custom set background style | Object | {} | | contentStyle | custom set content style | Object | {} | | bodyStyle | custom set body style | Object | {} | | modalId | modalId | String | '' | | topGap | custom set body top style | Number | 0 |

Usage Example

simple

<modal :title="modal.title" v-model="modal.visible" :verify="true">
    <label class="label">Slot Area,write your code in here</label>
    <p class="control">
        <label class="label">Name:</label>
        <input class="input" type="text" v-model="modal.text" placeholder="Your name">
    </p>
</modal>

Use api params to configure a MessageBox

<modal :title="modal2.title" v-model="modal2.visible" :bg-click="false" :verify="true" :bg-style="modal2.bgStyle" :content-style="modal2.contentStyle" :only-body="true" :modal-id="1">
    <label class="label">Welcome to use vue-flexible-modal</label>
    <p class="control">
        <button class="ok" @click="onShowModal2">ok</button>
    </p>
</modal>