v3confirm

A plugin dedicated for vue3 to show confirm dialog modal.
6,972 4
Install
npm install v3confirm
Latest Version:1.1.1
Vue:3
License:MIT
Last Updated:May 20, 2022
Links: GitHub  ·  npm
Maintainer: malekim

v3confirm

A plugin dedicated for vue3 to show confirm dialog modal. Currently the plugin works only with composition api.

Installation

The plugin can be installed by npm or yarn.

NPM

npm install v3confirm --save

Yarn

yarn add v3confirm

Usage

import { createApp } from 'vue'
import VueConfirmPlugin from 'v3confirm'
import App from '@/App.vue'

const app = createApp(App)
app.use(VueConfirmPlugin, {
  root: '#confirm',
  yesText: 'Yes',
  noText: 'No',
})
app.mount('#app')

Then in component with composition api:

<template>
  <button @click="deleteAllUsers">
  <button @click="deleteAllUsersWithAsync">
</template>
<script lang="ts">
  import { defineComponent } from 'vue'

  export default defineComponent({
    setup: () => {
      const deleteAllUsers = () => {
        confirm.show('Are you sure?').then((ok) => {
          if (ok) {
            alert('All users deleted')
          } else {
            alert('Users not deleted')
          }
        })
      }

      const deleteAllUsersWithAsync = async () => {
        const ok = await confirm.show('Are you sure?')

        if (ok) {
          alert('All users deleted')
        } else {
          alert('Users not deleted')
        }
      }

      return {
        deleteAllUsers,
        deleteAllUsersWithAsync,
      }
    },
  })
</script>

Options

root

Type: string

Default: none

An HTML element where confirm dialog is attached. It should be empty.

yesText

Type string

Default: 'yes'

A text used for confirm button.

noText

Type string

Default: 'no'

A text used for decline button.

Styles

This project is using bulma styles.

Related Packages

vue-confirm-gold

Confirm dialog for Vue: simple and flexible

320
vue-confirm-dialog

simple action confirm

673,100 190
wc-messagebox

Vue plugins | alert | confirm | toast

3,765
@zapadale/vue3-confirm-dialog

Vue.js 3 version of Simple Confirm Dialog verification plugin

2,181 0
vue-longpress

Hold the click in the button to confirm the action

2,875 74

Version History

Version Released Vue License
1.1.1 ^3.0.5 MIT
1.1.0 ^3.0.5 MIT
1.0.0 ^3.0.5 MIT