SweetAlert,清新文藝,快意靈動的甜心彈框

2021-07-05 13:29:49 字數 2141 閱讀 8885

顯示標題和內容:

new sweetalertdialog(this)

.settitletext("here's a message!")

.setcontenttext("it's pretty, isn't it?")

.show();

顯示異常樣式:

new sweetalertdialog(this, sweetalertdialog.error_type)

.settitletext("oops...")

.setcontenttext("something went wrong!")

.show();

顯示警告樣式:

new sweetalertdialog(this, sweetalertdialog.warning_type)

.settitletext("are you sure?")

.setcontenttext("won't be able to recover this file!")

.setconfirmtext("yes,delete it!")

.show();

顯示成功完成樣式:

new sweetalertdialog(this, sweetalertdialog.success_type)

.settitletext("good job!")

.setcontenttext("you clicked the button!")

.show();

自定義頭部影象:

new sweetalertdialog(this, sweetalertdialog.custom_image_type)

.settitletext("sweet!")

.setcontenttext("here's a custom image.")

.setcustomimage(r.drawable.custom_img)

.show();

確認事件繫結:

new sweetalertdialog(this, sweetalertdialog.warning_type)

.settitletext("are you sure?")

.setcontenttext("won't be able to recover this file!")

.setconfirmtext("yes,delete it!")

.setconfirmclicklistener(new sweetalertdialog.onsweetclicklistener() ).show();

顯示取消按鈕及事件繫結:

new sweetalertdialog(this, sweetalertdialog.warning_type)

.settitletext("are you sure?")

.setcontenttext("won't be able to recover this file!")

.setcanceltext("no,cancel plx!")

.setconfirmtext("yes,delete it!")

.showcancelbutton(true)

.setcancelclicklistener(new sweetalertdialog.onsweetclicklistener() ).show();

確認後切換對話方塊樣式:

new sweetalertdialog(this, sweetalertdialog.warning_type)

.settitletext("are you sure?")

.setcontenttext("won't be able to recover this file!")

.setconfirmtext("yes,delete it!")

.setconfirmclicklistener(new sweetalertdialog.onsweetclicklistener() ).show();

SweetAlert(彈出層外掛程式)

懷著非常 非常惱火的心情寫下這個博文。我深深懷疑有一些人只會瞎貼上複製別人的博文,自己試都不試就發布到網上,左右看的人想法,就此深通惡絕!廢話不多說。sweetalert是乙個簡潔好用的自製alert 外掛程式。再此,如果有的朋友懶得自己寫乙個alert 可以用用這個外掛程式,當然這個外掛程式,裡面...

sweetalert外掛程式的使用

urls.py from django.contrib import admin from django.urls import path urlpatterns path admin admin.site.urls path index views.index views.py python de...

Angular中sweetalert彈框的使用詳解

npm installangular sweetalert npm installsweetalert angular sweetalert sweetalert 但是只能用 sweetalert 中的css,js 必須通過 npmsweetalert sweetalert.min.js angul...