我需要调用 showToast 就生成一个 toas 提示框请把我把 showToast 函数写出来 用javascript代码
function showToast(message) { const toast = document.createElement('div'); toast.classList.add('toast'); toast.innerText = message; document.body.appendChild(toast); setTimeout(() => { toast.remove(); }, 3000); }
// CSS .toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); padding: 10px 20px; background-color: #333; color: #fff; border-radius: 5px; z-index: 9999; }
原文地址: https://www.cveoy.top/t/topic/bggV 著作权归作者所有。请勿转载和采集!