Git Product home page Git Product logo

vue-modal's Introduction

vue-modal-plugin

Usage

npm install vue-modal-plugin --save

init modal

var Vue = require('vue'),
    VueModal = require('vue-modal-plugin');

// regist vue-modal plugin    
Vue.use(VueModal);

// initial vue-modal
var modal = Vue.modal({
  target: element // insert modal element into target element which is child element of target element.
  template: template, // vue-modal template, type string.
  data: {

  },
  methods:{

  },
  autoDestroy: false // when the value is true, you won't need to invoke destroy().
});

template

<div class="modal-mask" v-show="show" transition="bg" xmlns:v-on="http://www.w3.org/1999/xhtml">
    <div class="modal-wrapper">
        <div v-show="show" transition="modal" class="transition-wrapper">
            <div class="modal-container">
                <content select=".modal-header">
                	<!-- please don't change this expression -->
                    <div class="modal-header">
                        {{modal.title}}<span v-on:click="close()"></span>
                    </div>
                </content>
                <content select=".modal-body">
                    <div class="modal-body">
                        <div class="form-group">
                            <div class="items notify-warn">
                                <p>{{modal.content}}</p>
                            </div>
                        </div>
                    </div>
                </content>
                <content select=".modal-footer">
                    <div class="modal-footer">
                        <button class="modal-button modal-cancel-button" v-on:click="updateData()">更新</button>
                        <button class="modal-button modal-cancel-button" v-on:click="confirm()">确定</button>
                    </div>
                </content>
            </div>
        </div>
    </div>
</div>

open

modal.open();

close

modal.close();

####destroy

modal.destroy();

update

modal.udpate({
  // data
})

####demo https://miaowing.me/vue-modal/example/index.html

vue-modal's People

Contributors

miaowing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

qfy081 yarsky-tgz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.