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

https://github.com/eddie0329/vue3-use-modal

vue3-use-modal is vue3(vue-next) plugin that provide easy use of modal.
https://github.com/eddie0329/vue3-use-modal

dialog dialog-plugin modal modal-plugin usedialog usemodal vue-plugin vue3-hooks

Last synced: 12 months ago
JSON representation

vue3-use-modal is vue3(vue-next) plugin that provide easy use of modal.

Awesome Lists containing this project

README

          





npm package
license
PR WELCOME
example
example



## 🎨 vue3-use-modal

`vue3-use-modal` is vue3(vue-next) plugin that provide easy use of modal. It is not only component based but also lets using modal either **asynchronous or synchronous** behavior.

> 🚨 Caution: `vue3-use-modal` is not compatitable with vue2.

## πŸ›  Installation

```shell
# using npm
npm install vue3-use-modal

# using yarn
yarn add vue3-use-modal
```

## πŸ“ Setting in Vue3

```javascript
import { ModalPlugin } from 'vue3-use-modal';

createApp(App).use(ModalPlugin).mount('#app');
```

## πŸ“ Setting in Nuxt3

```javascript
// plugins/modalPlugin
import { ModalPlugin } from 'vue3-use-modal';

export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(ModalPlugin);
})
```

```javascript
// nuxt.config.js
module.exports = {
plugins: [
{ src: '~/plugins/modalPlugin', mode: 'client' },
],
}
```

## 🏷 Type def

```typescript
import { useModal } from 'vue3-use-modal';
// shims-vue.d.ts
declare module 'vue' {
interface ComponentCustomProperties {
$modal: ReturnType
}
}
```

## 🎩 Usage vue-use-modal

#### ⭐️ See example [here](https://stackblitz.com/edit/vue-w6xg5y?file=src%2FApp.vue).

### 1> Define modal component:

```html