Giter VIP home page Giter VIP logo

vue-async-modal's Introduction

vue-async-modal

GitHub Actions Codacy Grade npm GitHub Release

David Peer David David Dev

Conventional Commits Renovate enabled JavaScript Style Guide Code Style: Prettier codechecks.io

Flexible modal component for Vue with ability of asynchronous lazy loading

Usage

Firstly, you should add Modal component in your template.

<template>
  <div id="app">
    <modal />
  </div>
</template>
<script>
import { Modal } from 'vue-async-modal'

export default {
  components: {
    Modal,
  },
}
</script>

Then, you will be able to get the modal instance via this.$modal in every Vue component.

We provide a basic modal component ModalItem.

If you want to open modal MyModal in component Demo:

// Demo.vue
<template>
  <button @click="loadMyModal"></button>
</template>
<script>
export default {
  methods: {
    loadMyModal() {
      this.$modal.open({
        id: 'my-modal',
        component: import('./MyModal.vue'),
        options: {
          destroy: true,
        },
        props: {
          whatever,
        },
      })
    },
  },
}
</script>

// MyModal.vue
<template>
  <!-- the simplest way to use default header template an override modal-title is use prop header -->
  <!-- if you want to use default footer template, just add prop `footer: true` -->
  <!-- every ModalItem instance will show/disppear with a fade transition by default -->
  <!-- you can define prop transition to use your own transition, or just pass empty string `transition` prop to disable it -->
  <modal-item :header="Modal Header" :footer="true">
    <!-- slot header will be content of .modal-header -->
    <template slot="header">
      <button>×</button>
      <h4>
        <div class="modal-title">I'm Modal Title</div>
      </h4>
    </template>

    <!-- default slot will be used as content in .modal-body -->
    I'm content of Modal Body

    <!-- or you can use slot body to rewrite whole .modal-body -->
    <div class="modal-body" slot="body">
      Let's rewrite default .modal-body
    </div>

    <!-- you can overwrite footer content by slot footer -->
    <template slot="footer">
      <!-- cancle/confirm text can be rewrote by prop `cancleText` and `confirmText` -->
      <button class="btn btn-default">取消</button>
      <!-- if you are using `footer: true`, it will trigger `confirm` event on clicking confirm btn-->
      <!-- or you can use prop `disbaled: true` to disbale it -->
      <button class="btn btn-primary">确定</button>
    </template>
  </modal-item>
</template>
<script>
import { ModalItem } from 'vue-async-modal'

export default {
  components: {
    ModalItem,
  },
}
</script>

API

There are several useful methods on modal instance:

  1. open a modal instance
this.$modal.open({id, component, options, props}): Promise

id is optional, if no id passed in, it will generate a id by timestamp.

component could be a normal Vue component or a promise which will resolve a Vue component, so that we could use code spit and dynamic loading here.

options: {show, backdrop, destroy}:

show and backdrop will true if you don't set it.

If show is true, when you open modal, it will show automatically, or it will just add into DOM without displaying.

If backdrop is true, modal will open with a transparent black backdrop, unless backdrop is static, when user click modal outside, modal will auto trigger close event.

If destroy is true, the modal instance will destroy automatically on closing.

  1. close or destroy a modal instance
this.$modal.close(id, destroy): Promise

If id is falsy, it will be automatically choose current modal instance id.

if destroy is true, the modal instance will be destroyed even if it's options.destroy is false.

Changelog

Detailed changes for each release are documented in CHANGELOG.md.

License

MIT © JounQin@1stG.me

vue-async-modal's People

Contributors

jounqin avatar renovate-bot avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

vue-async-modal's Issues

An in-range update of vue-loader is breaking the build 🚨

The devDependency vue-loader was updated from 15.6.3 to 15.6.4.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

vue-loader is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of webpack-cli is breaking the build 🚨

The devDependency webpack-cli was updated from 3.1.2 to 3.2.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

webpack-cli is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 124 commits.

  • 6253a73 chore: v.3.2.0
  • 0c3be76 chore: make tests pass
  • 0b6bab3 chore: better defaults
  • 78436ff chore: add-on -> scaffold
  • 3281372 chore: simplify clean-all script
  • b0f4a0f chore: addon -> scaffold
  • 82c9ea8 chore: update lockfiles
  • a3fe013 Merge pull request #716 from EvsChen/dist-scaffold
  • f9bb82d Merge pull request #693 from lakatostamas/feature/find-config-recursively
  • 3ec2e9d chore: resolve conflict
  • 83602d4 chore: update package lock and scripts
  • d82b016 Merge pull request #720 from rishabh3112/patch-7
  • 4d9c847 Merge pull request #723 from eavichay/patch-1
  • 4b2a127 docs: improve the docs (#722)
  • 9ad8c1d See #721

There are 124 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

ModalItem.vue and Modal.vue missing

Hi everybody!

I was using you library, but with the newest update (conversion to typescript) there are some errors:

After NPM install there is a lib folder under node_modules/vue-async-modal

in lib/index.js there are 2 exports:

export { default as Modal } from './Modal.vue';
export { default as ModalItem } from './ModalItem.vue';

Unfortunately the Modal.vue and ModalItem.vue are missing.
Interestingly, they are available in the src folder in the Github repo, so I guess they are lost during compilation?

image

I would add them manually, but then I can't update my node packages anymore.

Thanks for your help! :)

An in-range update of prettier is breaking the build 🚨

The devDependency prettier was updated from 1.14.3 to 1.15.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

prettier is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for Prettier 1.15: HTML, Vue, Angular and MDX Support

🔗 Release Notes

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Catch errors

Hello,

Is there a correct way to catch error thrown by the modal?

For example i have used a data prop that was not defined in my template, and outside i get the error as follows:

TypeError: this modal item is not a Vue component, you should use `transition` component and emit `after-leave` event
    at VueComponent.eval (Modal.vue?9127:146)
    at Array.eval (vue.esm.js?a026:1989)
    at flushCallbacks (vue.esm.js?a026:1915)

This error its throw what ever error is thrown inside the modal component.

An in-range update of vue is breaking the build 🚨

The devDependency vue was updated from 2.5.17 to 2.5.18.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

vue is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v2.5.18

Includes everything in 2.5.18-beta.0

Bug Fixes

Commits

The new version differs by 164 commits ahead by 164, behind by 4.

  • dadc918 build: release 2.5.18
  • eb81ec2 build: build 2.5.18
  • dfaf9e2 fix(types): type support for advanced async components (#8438)
  • 8a2dbf5 fix(transition-group): fix activeInstance regression
  • 0ed0aad fix: fix keyName checking for space and delete in IE11 (#9150)
  • f077ed1 fix(ssr): fix ssr template publicPath generation
  • 93850f4 chore: fix sponsor link
  • 1b4a8a0 fix(compiler): fix codegen for v-for component inside template
  • 448ba65 fix(types): correct scopedSlot types (#9131)
  • 0d7fb73 chore: update sponsors/backers [ci skip]
  • e8031b4 build: release v2.5.18-beta.0
  • fe194dd build: build v2.5.18-beta.0
  • 3078352 fix(ssr): resolve server directives the same as on client (#9129)
  • aca17b4 ci: add regression test for popular libraries in Vue.js ecosystem (#8608)
  • e4b1b57 fix(ssr): adjust call stack size defer threshold

There are 164 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

.scss files missing

I found another issue while deploying (Didn't run into this issue, because the files where already available).

The .vue files are now in there, but the .scss files are still missing.

Thanks in advance and stay healthy!

best, Florian

An in-range update of nodemon is breaking the build 🚨

The devDependency nodemon was updated from 1.18.5 to 1.18.6.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

nodemon is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v1.18.6

1.18.6 (2018-11-05)

Bug Fixes

Commits

The new version differs by 1 commits.

  • 521eb1e fix: restart on change for non-default signals (#1409) (#1430)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

An in-range update of vue-template-compiler is breaking the build 🚨

The devDependency vue-template-compiler was updated from 2.5.17 to 2.5.18.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

vue-template-compiler is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v2.5.18

Includes everything in 2.5.18-beta.0

Bug Fixes

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of babel7 is breaking the build 🚨

There have been updates to the babel7 monorepo:

    • The devDependency @babel/core was updated from 7.1.1 to 7.1.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the babel7 group definition.

babel7 is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (@)

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.