Git Product home page Git Product logo

vue-modal-provider's Introduction

vue-modal-provider

nice-modal-react vue implementation. Simple to use and manage modal.

Document

HereThe online document.

Installation

$ npm install vue-modal-provider

Examples

Embed your application with ModalProvider

<!--App.vue -->
<script setup lang="ts">
import { RouterView } from "vue-router";
import { ModalProvider } from "vue-modal-provider";
</script>

<template>
  <ModalProvider>
    <RouterView />
  </ModalProvider>
</template>

Create modal component

<!-- Modal.vue -->
<template>
  <el-dialog v-model="visible">
    {{ args }}
    <el-button @click="hide(), resolve(1111), remove()">close</el-button>
  </el-dialog>
</template>

<script lang="ts" setup>
import { useModalRef } from "vue-modal-provider";
const {
  // show variables
  visible,
  // close modal
  hide,
  args,
  // remove modal lose animation
  remove,
  resolve,
  reject,
} = useModalRef();
</script>

Use in the view

<script lang="ts" setup>
import { useModal } from "vue-modal-provider";
import TestModal from "./Modal.vue";
const { show } = useModal(TestModal);

function showModal() {
  show("test msg").then((c) => {
    console.log(c);
  });
}
</script>

<template>
  <el-button @click="showModal">open modal</el-button>
</template>

vue-modal-provider's People

Contributors

jinghuis 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

Watchers

 avatar  avatar

Forkers

jagdishelsner

vue-modal-provider's Issues

弹窗嵌套时报错,导致内层弹窗永远无法打开了

场景: A 和 B 都是使用 vue-modal-provider 包装过的 Modal,单独使用没问题,如果在 A 里打开 B,关闭 B 时就会报错,此后 B 就再也无法打开了 无论是否还在 A 中操作,看报错是在 resolve 时框架内部崩了
image
image

捉个文档的虫

<!--App.vue -->
<script setup lang="ts">
import { RouterView } from "vue-router";
import { ModalProvider } from "vue-modal-provider";

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.