我正在使用 axios CDN 链接,但它给出了此错误
Refused to load the script 'https://unpkg.com/axios/dist/axios.min.js' because it violates the following Content Security Policy directive: "script-src 'self'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
我正在使用哈巴狗模板引擎。这是我的 base.pug 代码:
doctype html
html
head
meta(charset='UTF-8')
meta(name='viewport' content='width=device-width, initial-scale=1.0')
title Natours |#{title}
link(rel='stylesheet' href='/css/style.css')
link(rel='shortcut icon' type='image/png' href='/img/favicon.png')
link(rel='stylesheet' href='https://fonts.googleapis.com/css?family=Lato:300,300i,700')
body
//header
include _header
//content
block content
h1 this is a placeholder
//footer
include _footer
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
script(src='/js/login.js')
Run Code Online (Sandbox Code Playgroud)
这是我的login.js
const login=async (email,password)=>{
try{ …Run Code Online (Sandbox Code Playgroud)