function common_alert(text, class_str) { if (!class_str) { class_str = 'alert-warning' } // reset bootstrap.bundle.js 里的方法 const bundle_alert = typeof ($('.alert').alert) === 'function' if (bundle_alert) { $('.alert').alert('close') } // content const content = ` ` // append $('body').append(content) // clean if (bundle_alert) { setTimeout(function () { $('.alert').alert('close') }, 1500) } } function primary_alert(text) { common_alert(text, 'alert-primary') }