看板 Web_Design 關於我們 聯絡資訊
想請教各位如果網站有大量popup的需求, 並且會有頁面重複使用的狀況發生。 不曉得大家語法會怎麼處理? 過去我都是寫在html的頁面裡, 不過這次專案比較大, 為了管理方便,想找看看比較好的寫法。 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 101.13.212.234 ※ 文章網址: https://www.ptt.cc/bbs/Web_Design/M.1535815722.A.815.html
sa0124: 可以寫一隻popup.js, export default出來,要用就import 09/02 01:47
sa0124: 進去 09/02 01:47
shter: 用 <script src="popup.js">放到要用的 html 頁面 09/02 01:51
shter: 內容開頭用 function popupFn(){...} 包 code 就好 09/02 01:53
chiawu: 謝謝你們! 09/02 11:45