Giter Site home page Giter Site logo

k-avin / imdb_web Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 28.94 MB

The Internet Movie Database (IMDb) is an online database containing information and statistics about movies, TV shows and video games as well as actors, directors and other film industry profession…

JavaScript 68.65% HTML 2.62% Vue 19.11% CSS 9.63%

imdb_web's Introduction

Vue Simple Alert

screenshot

version Vue.js version total downloads downloads Codacy Badge license

Simple alert(), confirm(), prompt() for Vue.js, using sweetalert2.

Demo

Check out live demo

Features

  • Provides simple alert(), confirm(), prompt() like DOM Window methods.
  • Based on sweetalert2.
  • Installed as a Vue.js plugin.
  • Promise based API.
  • Support typescript.

Install

npm i vue-simple-alert

Basic Usage

install plugin

// main.js
import Vue from "vue";
import VueSimpleAlert from "vue-simple-alert";

Vue.use(VueSimpleAlert);

Alert

// in any component

this.$alert("Hello Vue Simple Alert.");

Confirm

// in any component

this.$confirm("Are you sure?").then(() => {
  //do something...
});

Prompt

// in any component

this.$prompt("Input your name").then(text => {
  // do somthing with text
});

Advanced Usage

Global options

Global options can be set when initialize plugin. Refer to sweetalert2 documentation

// main.js
import Vue from "vue";
import VueSimpleAlert from "vue-simple-alert";

Vue.use(VueSimpleAlert, { reverseButtons: true });

More advanced usage

You can use sweetalert2's fire() method through $fire(). For detailed usage, refer to sweetalert2 documentation.

// in any component

this.$fire({
  title: "Title",
  text: "text",
  type: "success",
  timer: 3000
}).then(r => {
  console.log(r.value);
});

API

alert(message?, title?, type?, options?)

The alert() method displays an alert box with a specified message and an OK button.

  • message: string

Optional. Specifies the text to display in the alert box

  • title: string

Optional. Specifies title of the alert box

  • type: 'success' | 'error' | 'warning' | 'info' | 'question'

Optional. Specifies icon type.

  • options: SweetAlertOptions

Optional. Advanced options. Refer to sweetalert2 documentation.

  • returns: Promise<boolean>

Will be resolved with true when alert box closed.

confirm(message?, title?, type?, options?)

The confirm() method displays a dialog box with a specified message, along with an OK and a Cancel button.

  • message: string

Optional. Specifies the text to display in the confirm box

  • title: string

Optional. Specifies title of the confirm box

  • type: 'success' | 'error' | 'warning' | 'info' | 'question'

Optional. Specifies icon type.

  • options: SweetAlertOptions

Optional. Advanced options. Refer to sweetalert2 documentation.

  • returns: Promise<boolean>

Will be resolved when OK button clicked. If confirm box closed by any other reason, this promise will be rejected.

prompt(message, defaultText?, title?, type?, options?)

The prompt() method displays a dialog box that prompts the user for input.

  • message: string

Required. Specifies the text to display in the dialog box

  • defaultText: string

Optional. The default input text

  • title: string

Optional. Specifies title of the confirm box

  • type: 'success' | 'error' | 'warning' | 'info' | 'question'

Optional. Specifies icon type.

  • options: SweetAlertOptions

Optional. Advanced options. Refer to sweetalert2 documentation.

  • returns: Promise<string>

Will be resolved with input text when OK button clicked. If the user clicks OK without entering any text, promise will be resolved with an empty string. If dialog box closed by any other reason, this promise will be rejected.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE file for details

imdb_web's People

Contributors

k-avin avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.