错误代码
Refused to execute inline script because it violates the following Content Security Policy directive: “default-src ‘self’”. Either the ‘unsafe-inline’ keyword, a hash (‘sha256-2/nwTfnmhsEOQ+pVDGpNeMyOzp4HRtQri8QvvBb+A6Q=’), or a nonce (‘nonce-…’) is required to enable inline execution. Note also that ‘script-src’ was not explicitly set, so ‘default-src’ is used as a fallback.
翻译
拒绝执行内联脚本,因为它违反了以下内容安全策略指令:“default src’self’”。启用内联执行需要“不安全内联”关键字、哈希(‘sha256-2/nwTfnmhsEOQ+pVDGpNeMyOzp4HRtQri8QvvBb+A6Q=’)或随机数(‘once-…’)。还请注意,未显式设置“script src”,因此使用“default src”作为回退
表单默认会把没有声明属性type的button标签,作为submit按钮:
<form action="" method="POST">
<input type="text" id="username">
<input type="password" id="password">
<button id="login" >登录</button>
</form>
把按钮加上 type="button"属性,或者写到外边
<button id="login" type="button">登录</button>
此错误其余场景不详!