Sweetalert API Chinese Development Documentation and manuals

Source: Internet
Author: User

Configuration

Here is the key you can use if you pass an object to Sweetalert:

Description
Parameters Default ValueDescription
Title Null (required) The title of the modal. It can either is added to the object under the key "title" or passed as the first parameter of the function.
Text Null A description for the modal. It can either is added to the object under the key "text" or passed as the second parameter of the function.
Type Null The type of the modal. Sweetalert comes with 4 built-in types which would show a corresponding icon animation: "Warning", "error", "Success" and " Info ". You can also set it as "input" to get a prompt modal. It can either is put in the object under the key "type" or passed as the third parameter of the function.
Allowescapekey True If set to True, the user can dismiss the modal by pressing the Escape key.
Customclass Null A custom CSS class for the modal. It can added to the object under the key "Customclass".
Allowoutsideclick False If set to True, the user can dismiss the modal by clicking outside it.
Showcancelbutton False If set to True, a "Cancel"-button is shown, which the user can click on to dismiss the modal.
Showconfirmbutton True If set to False, the "ok/confirm"-button would be hidden. Make sure your set a timer or set Allowoutsideclick to True if using this, in order not to annoy the user.
Confirmbuttontext "OK" Use the-the text on the "Confirm"-button. If Showcancelbutton is set as true, the Confirm button would automatically show "confirm" instead of "OK".
Confirmbuttoncolor "#AEDEF4" Use the background color of the ' Confirm '-button (must be a HEX value).
Cancelbuttontext "Cancel" Use the-the text on the "Cancel"-button.
Closeonconfirm True Set to False if you want the modal to stay open even if the user presses the "Confirm"-button. This was especially useful if the function attached to the ' Confirm '-button is another sweetalert.
Closeoncancel True Same as closeonconfirm, but for the Cancel button.
ImageUrl Null ADD A customized icon for the modal. Should contain a string with the path to the image.
ImageSize "80x80" If IMAGEURL is set, you can specify imageSize to describes how big are want the icon to being in PX. Pass in a string with the values separated by an "x". The first value is the width of the second is the height.
Timer Null Auto Close timer of the modal. Set in MS (milliseconds).
Html False If set to True, would not escape title and text parameters. (Set to False if your ' re worried about XSS attacks.)
Animation True If set to False, the modal ' s animation would be disabled. Possible (String) values:pop (default when animation set to true), Slide-from-top, Slide-from-bottom
InputType "Text" The type of the input field when using the type: ' Input ' (this can is useful if you want users to type in their passwor D for example).
Inputplaceholder Null When using the Input-type, you can specify a placeholder to the user.
Inputvalue Null Specify a default text value, want your input to show when using type: "Input"
Showloaderonconfirm False Set to True to disable the buttons and show this something is loading.
MethodSweetalert also provides some simple methods that you can invoke:
Function Example Description
SetDefaults Swal.setdefaults ({confirmbuttoncolor: ' #0000 '}); If you end up using a lot of the same settings when calling Sweetalert, you can use SetDefaults at the start of your progr AM to set them once and for all!
Close Swal.close (); Close the currently open Sweetalert programatically.
Showinputerror Swal.showinputerror ("Invalid email!"); Show an error message after validating the input field, if the user's data is bad
Enablebuttons, Disablebuttons Swal.disablebuttons (); Disable or enable the user to click on the Cancel and Confirm buttons.
CONTRIBUTE

Sweetalert API Chinese Development Documentation and manuals

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.