1 回答

TA贡献1776条经验 获得超12个赞
我通过在承诺中添加我的所有事件来解决这个问题,例如:
return new Promise((resolve, reject) => {
if(!localStorage.getItem("name")){
$('body').append(this.popup);
$("input[name=loginOption]:radio").change(function (event) {
that.userOption = $(event.target).val();
$("button").prop('disabled', false);
})
$("button").prop('disabled', true);
$("button").click(function () {
that.value = false;
localStorage.setItem("name", that.userOption);
resolve(true);
})
}
if(localStorage.getItem("name")){
resolve(true);
}
});
这对我来说可以。
添加回答
举报