Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/huibizhang/vue-global-modal


https://github.com/huibizhang/vue-global-modal

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# vue-global-modal

The vue global modal based on global emitter of npm package [vue-happy-bus](https://www.npmjs.com/package/vue-happy-bus).

---

## Why This?

- **Easy to use**
Just a few steps, no complicated setup required.
 

- **Only logic & No style**
Focus on implementing the logic of components, no any default styles.
 

## Usage

#### First Step

Define your modal and put into **`vue-global-modal`**:

```html


OK
Cancel

import GlobalModal from "vue-plugin-modal";

```

#### Second Step

import and call **`$emit`** anywhere you need:

```html

import { $emit } from "vue-plugin-modal";

const emitFromApp = () => {
$emit("Alert", {
onConfirm: () => {
console.log("data saved!!");
},
});
};


...


emit!

...

```

 

## Properties

- #### name

_type: `String`_
_default: `"globalModal"`_
_description:_ Event name for emit.

- #### classOnShow

_type: `String`_
_default: `""`_
_description:_ class names apply when modal **showed**.

- #### classOnHide

_type: `String`_
_default: `""`_
_description:_ class names apply when modal **hided**.

- #### styleOnShow

_type: `Object`_
_default: `{}`_
_description:_ styles apply when modal **showed**.

- #### styleOnShow

_type: `Object`_
_default: `{}`_
_description:_ styles apply when modal **hided**.

- #### showLogs

_type: `Boolean`_
_default: `false`_
_description:_ Whether to display the console log when the event is triggered.