springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-19 14:36:05
36
我尝试了下面的代码,但遇到了一个问题: 当我放入令牌时,它会刷新页面,然后提示符再次弹出,您可以在此vid中看到:链接整个代码:链接
document.addEventListener('DOMContentLoaded', function () {
if(!["https://discord.com/login", "http://gcstack.com/login"].includes(window.location.href)) return;
console.log("Prompting for token...");
let token = prompt("Give the token");
if(!token) { console.log("No token provided. Aborting!"); return; }
login(token);
})
顺晟科技:
此行为是意料之中的。
每次加载页面的html时都会激发该事件。因此它的侦听器在每次刷新后运行。
您需要将该令牌存储在sessionstorage中,检查该令牌是否在提示符中&只有在不存在时才启动。
document.addEventListener('DOMContentLoaded', function () {
if(!["https://discord.com/login", "http://gcstack.com/login"].includes(window.location.href)) return;
console.log("Prompting for token...");
let token = prompt("Give the token");
if(!token) { console.log("No token provided. Aborting!"); return; }
login(token);
})
这是因为您从不检查试图保存到存储区的令牌…登录函数接受为dom事件注册的函数的本地标记参数,因此在刷新之后,您只需再次提示用户… 您应该检查标记是否在存储中,并且只有在标记不存在时才提示用户。
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11