# vue-confirm-plugin

> Vue Confirm Plugin is async wrapper for Vue component.

Latest version **0.0.4** (published 2019-07-10) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2019-07-10 |
| First published | 2019-06-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Anton Sukhodolets |
| Maintainers | antohan |
| Keywords | vue, confirm |

## Links

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

## Recent versions

- 0.0.4 (latest) — 2019-07-10
- 0.0.3 — 2019-07-10
- 0.0.2 — 2019-06-20
- 0.0.1 — 2019-06-20

## README

# Vue Confirm Plugin

Vue Confirm Plugin is async wrapper for Vue component.

## Installation
### Add package
```bash
# yarn
yarn add vue-confirm-plugin

# npm
npm i vue-confirm-plugin
```

### Install plugin
```javascript
import Vue from 'vue';
import VueConfirmPlugin from 'vue-confirm-plugin';

Vue.use(VueConfirmPlugin);
```

## Usage

[Example of usage with Material Design](https://github.com/Antohan/confirm-plugin-example)

1. Import you component:
```javascript
import ConfirmDialog from './components/confirm-dialog';
```

2. Pass your component in to `this.$confirm()`
```javascript
this.$confirm(ConfirmDialog).then(res => {
  // res is answer from dialog.
});
```
or with props (**the plugin get props as data object**)
```javascript
const dialogProps = {
  question: this.confirmMessage,
};

this.$confirm(ConfirmDialog, dialogProps).then(res => {
  // res is answer from dialog.
});
```

Also you can use `async/await` syntax.

If you pass additional props, you should describe this in the dialog component props.

```javascript
{
...
  name: 'ConfirmDialog',
  props: {
    // dialogProps
    question: {
      type: String,
      required: true,  
    },
  },
...
}
```

And has method choose which calling by dialog actions
```javascript
methods: {
/**
 * Set user choice and
 * destroy the dialog.
 *
 * @param {boolean} value User choise.
 */
  choose(value) {
    this.choice = value;
    this.$destroy();
  }
},
```

Value which get to `this.choice` was taking in `this.$confirm` as result.

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