启动项目后控制台出现如下信息,并且页面内显示Cannot GET /Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-cEmJ9wfQpnZLR35+jGeZk1WmknBbXo0CyiXREeJHUGo='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.
1 回答

梵蒂冈之花
TA贡献1900条经验 获得超5个赞
这个是由于csp安全限制。有以下几种解决方法
服务端设置,例如在nginx配置文件中的server {} 做如下配置
add_header Content-Security-Policy "default-src 'self' style-src 'self' 'unsafe-inline';" ;
改变你css的写法,不要使用内联方式,放到css文件中,例如不要出现如下写法
<li v-for="pageInfo in pageInfos" style="list-style: none">
添加回答
举报
0/150
提交
取消