Skip to content

MuratovBektur/vuejs-dialog-box

Repository files navigation


Vue dialog modal box (alert, prompt, confirm)

A dialog for alerts, prompts, and confirms that is lightweight and based on promises with Typescript support (only supports vue 2).


Install

$ npm install --save @prostreyd/vue-dialog

Quick Start Usage

//in main.ts or main.js
import Vue from 'vue'
import VuejsDialogBox from "@prostreyd/vue-dialog";
import "@prostreyd/vue-dialog/dist/style.css";

Vue.use(VuejsDialogBox);

Alert


await this.$dialogBox.title({
  // bottom default values
  title: "This is alert", // String. Title of dialog
  okText: "Ok" // String. Confirm button text
});
//...your code


Prompt


const text = await this.$dialogBox.prompt({
  // bottom default values
  title: "Write something", // String. Title of dialog.
  okText: "Yes", // String. Confirm button text.
  cancelText: "No", // String. Cancel button text.
  placeholder: "", // String. Input placeholder text.
  allowConfirmEmptyString: false, // Boolean. Is it possible to click on the confirm button if the text is empty. 
});

//...your code


Confirm


const ok = await this.$dialogBox.confirm({
  // bottom default values
  title: "Are you sure?", // String. Title of dialog.
  okText: "Yes", // String. Confirm button text.
  cancelText: "No", // String. Cancel button text.
});

if (ok) {
  //...your code
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published