我是想点击时才触发sweettalert函数,可是我不点他就自动触发了
<script>
var btn = document.querySelector('button');
btn.addEventListener('click', sweetalert('error', 'i like you', 'success'));
function sweetalert(title, text, icon) {
Swal.fire({
title: title,
text: text,
icon: icon,
confirmButtonText: 'Cool'
})
}
</script>