# vue-confirm-dialog

> simple action confirm

Latest version **1.1.0** (published 2022-03-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-confirm-dialog
pnpm add vue-confirm-dialog
yarn add vue-confirm-dialog
bun add vue-confirm-dialog
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2022-03-18 |
| First published | 2019-10-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 23.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 190 |
| Author | Onur Aslan |
| Maintainers | aslanonur |
| Keywords | vue, confirm, dialog, popup, plugin |

## Links

- npm: https://www.npmjs.com/package/vue-confirm-dialog
- Repository: https://github.com/aslanon/vue-confirm
- Homepage: https://github.com/aslanon/vue-confirm#readme
- Issues: https://github.com/aslanon/vue-confirm/issues
- npm.io page: https://npm.io/package/vue-confirm-dialog

## Alternatives

- [react-native-root-siblings](https://npm.io/package/react-native-root-siblings.md) — 102.9K weekly downloads
- [@praxisui/dialog](https://npm.io/package/@praxisui/dialog.md) — 2.0K weekly downloads
- [easy-toggle-state](https://npm.io/package/easy-toggle-state.md) — 350 weekly downloads
- [ngx-lightbox-evp](https://npm.io/package/ngx-lightbox-evp.md) — 19 weekly downloads
- [react-native-modal-translucent-axton](https://npm.io/package/react-native-modal-translucent-axton.md) — 4 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2022-03-18
- 1.0.2 — 2020-05-31
- 1.0.1 — 2020-05-31
- 1.0.1-2 — 2020-05-31
- 1.0.1-1 — 2020-05-31
- 1.0.1-0 — 2020-05-31
- 1.0.0 — 2020-05-31
- 0.2.5 — 2019-11-12
- 0.2.4 — 2019-10-27
- 0.2.3 — 2019-10-26
- 0.2.2 — 2019-10-14
- 0.2.1 — 2019-10-14
- 0.2.0 — 2019-10-14
- 0.1.9 — 2019-10-07
- 0.1.8 — 2019-10-06
- … 8 more at https://npm.io/package/vue-confirm-dialog/versions

## README

[![issues](https://badgen.net/github/open-issues/aslanon/vue-confirm-dialog)](https://github.com/aslanon/vue-confirm-dialog/issues) [![npm](https://badgen.net/npm/dt/vue-confirm-dialog)](https://www.npmjs.com/package/vue-confirm-dialog) [![npm version](https://badge.fury.io/js/vue-confirm-dialog.svg)](https://www.npmjs.com/package/vue-confirm-dialog) [![license](https://badgen.net/github/license/aslanon/vue-confirm-dialog)](https://github.com/aslanon/vue-confirm-dialog/blob/master/LICENSE)

# vue-confirm-dialog

Simple Confirm Dialog verification plugin with Vue.js.

Demo: https://aslanon.github.io/vue-confirm-dialog/

![confirm-dialog](https://raw.githubusercontent.com/aslanon/vue-confirm-dialog/master/example/src/static/confirm-dialog.png)

![vue-confirm](https://media.giphy.com/media/KzDUV51RkigyVBsJgA/giphy.gif)

## Install

```bash
$ npm install --save vue-confirm-dialog
```

## Quick Start Usage

In main.js or plugin (for Nuxt.js):

```js
import Vue from 'vue'
import VueConfirmDialog from 'vue-confirm-dialog'

Vue.use(VueConfirmDialog)
Vue.component('vue-confirm-dialog', VueConfirmDialog.default)
```

In App.vue (or in the template file for Nuxt.js (layout/default.vue)):

```html
<template>
  <div id="app">
    <vue-confirm-dialog></vue-confirm-dialog>
    <!-- your code -->
  </div>
</template>

<script>
  export default {
    name: 'app'
  }
</script>
```

In any of functions :

```js
methods: {
    handleClick(){
      this.$confirm(
        {
          message: 'Are you sure?',
          button: {
            no: 'No',
            yes: 'Yes'
          },
          /**
          * Callback Function
          * @param {Boolean} confirm
          */
          callback: confirm => {
            if (confirm) {
              // ... do something
            }
          }
        }
      )
    }
  }
```

If you want to use in \*.js file (e.g Vuex Store) before import Vue and after use Vue.\$confirm.

```js
import Vue from 'vue'

export default {
  namespaced: true,
  state: {},
  actions: {
    logout({ commit }) {
      Vue.$confirm({
        title: 'Are you sure?',
        message: 'Are you sure you want to logout?',
        button: {
          yes: 'Yes',
          no: 'Cancel'
        },
        callback: confirm => {
          // ...do something
        }
      })
    }
  }
}
```

## API

If you want to password confirm, "auth" key is must be true.

```js
this.$confirm({
  auth: true,
  message: 'foo',
  button: {
    yes: 'Yes',
    no: 'Cancel'
  },
  /**
   * Callback Function
   * @param {Boolean} confirm
   * @param {String} password
   */
  callback: (confirm, password) => {
    if (confirm && password == YOUR_PASSWORD) {
      // ...do something
    }
  }
})
```

## Use only for information

If you want to use only for information and you want of see one button in dialog, you can use only one of 'no' or 'yes' button object.

![vue-confirm](https://media.giphy.com/media/U3y0rmoC4SUySJxJqL/giphy.gif)

```js
methods: {
    handleClick(){
      this.$confirm(
        {
          title: 'Information',
          message: 'This content has been removed',
          button: {
          	yes: 'OK',
          }
        },
        /**
        * Callback Function
        * @param {Boolean} confirm
        */
        callback: confirm => {
          if (confirm) {
            // ... do something
          }
        }
      )
    }
  }
```

---
_Source: https://npm.io/package/vue-confirm-dialog · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
