Žel*_*jić 1 javascript angular sweetalert2
异步收到响应后如何更改文本?
\n\n var swText = "<h3>Importiranje kvota, molimo sa\xc4\x8dekajte...</h3>";\n swal({ html: swText });\n swal.showLoading();\n this.koloService.importExcelFileWithOdds(this.brojKola, fileList)\n .subscribe(\n data => { swText = "<h3>Importiranje zavr\xc5\xa1eno!</h3>"; swal.hideLoading(); },\n error => { swText = "<h3>Importiranje zavr\xc5\xa1eno!</h3>"; swal.hideLoading(); });\nRun Code Online (Sandbox Code Playgroud)\n\n另外,在收到服务器响应后如何隐藏进度警报?\n导入数据时进度警报如下所示:\n
在我收到服务器的响应后,进度警报不会隐藏,只有一个“确定”按钮可以关闭警报 - 我希望它在收到服务器的响应后立即关闭。\n
更新(2022):使用Swal.update()方法:
Swal.fire('After mignight I will turn into a pumpkin')
swal.showLoading()
// change the title after 2 seconds
setTimeout(() => {
Swal.update({ title: 'I am a pumpkin now!' })
Swal.hideLoading()
}, 2000)Run Code Online (Sandbox Code Playgroud)
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>Run Code Online (Sandbox Code Playgroud)
有各种 getter 用于访问 SweetAlert2 的不同部分:https ://sweetalert2.github.io/#methods
您正在寻找Swal.getTitle():
Swal.fire('After mignight I will turn into a pumpkin')
swal.showLoading()
// change the title after 2 seconds
setTimeout(() => {
Swal.getTitle().textContent = 'I am a pumpkin now!'
Swal.hideLoading()
}, 2000)Run Code Online (Sandbox Code Playgroud)
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6871 次 |
| 最近记录: |