如何解决?
我尝试过:https://stackoverflow.com/a/13585135/11799442
let request = new XMLHttpRequest();
request.open("GET", "http://localhost:8080", true);
request.onreadystatechange = function () {
if (request.readyState === 4 && request.status == 200) {
if (request.onreadystatechange) {
request.onreadystatechange = null;
//......
}
}
};
request.send();
request.onreadystatechange =函数()
该功能执行两次。不多不少