我正在制作一個按鈕,當用戶單擊時,打開一個 Swal ......問題是,我怎樣才能在那個 swal 模態中放置一個 Pdf 視圖,而不將用戶發送到另一個頁面?
使用 Sweet Alert 庫可以做到這一點嗎?我怎樣才能做到這一點?
uj5u.com熱心網友回復:
您可以在 SweetAlert 中添加一些 html 代碼。
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'
})
然后嘗試使用嵌入添加您的 pdf,例如:
<embed src="files/Brochure.pdf" type="application/pdf" width="100%" height="600px" />
參考:
https://sweetalert2.github.io/
https://www.codexworld.com/embed-pdf-document-file-in-html-web-page/
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/462040.html
標籤:javascript html pdf 模态对话 甜蜜警报2
