现在有类似这样的代码
mui(document).on("tap", ".delete", function() {
console.log('mui(document).on("tap", ".delete")');
commentId = this.getAttribute('comment-id');
console.log(commentId);
deleteLetterComment(commentId);
});
我想把这里面的function提出来复用。我知道可以这么写
mui(document).on("tap", ".delete", beforeDeleteLetterComment);
function beforeDeleteLetterComment() {
console.log('mui(document).on("tap", ".delete")');
commentId = this.getAttribute('comment-id');
console.log(commentId);
deleteLetterComment(commentId);
}
然而还有一段代码需要传递参数
function beforesubmitComment(str)
{
}
我想也这样用,但是直接写mui(document).on("tap",".delete",beforesubmitComment(str));
不生效
求助该怎么写。