我正在使用 Sweetalertjs 并且我已經將其編碼為向用戶顯示彈出訊息:
$(document).ready(function(){
let popup_shown = false;
let cookies = document.cookie.split('; ');
for( let i=0; i<cookies.length; i ){
cookie = cookies[i].split('=');
if( cookie[0] == 'zxczxc' )
popup_shown = true;
}
if( !popup_shown ){
var popup_data = '{!! $output !!}'
Swal.fire({ html:popup_data });
document.cookie = "zxczxc=1; path=/";
}
});
它運行良好且完美,但我只需要知道如何更改默認設定為Ok的 Cofirm 按鈕文本。
所以我進行了搜索,他們說我可以通過以下方式做到這一點:
swal({
confirmButtonText: 'Yes, I am sure!',
},
但這是錯誤的,因為我使用Swal.fire.
那么在這種情況下如何更改確認按鈕文本?
uj5u.com熱心網友回復:
Swal.fire({
title: '<strong>HTML <u>example</u></strong>',
icon: 'info',
html:
'You can use <b>bold text</b>, '
'<a href="//sweetalert2.github.io">links</a> '
'and other HTML tags',
showCloseButton: true,
showCancelButton: true,
focusConfirm: false,
confirmButtonText:
'<i ></i> Great!',
confirmButtonAriaLabel: 'Thumbs up, great!',
cancelButtonText:
'<i ></i>',
cancelButtonAriaLabel: 'Thumbs down'
})
請檢查它在他們的官方 github 頁面https://sweetalert2.github.io/上的解釋
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/352655.html
標籤:javascript php 拉拉维尔 甜甜的 甜蜜警报2
