Has anyone encountered this message while trying to display a toast while using Helmet?
The toast still displays but, I'm not sure why the error is.
您的浏览器似乎阻止了此操作,因为data:
图像未在内容安全策略中列入白名单。CSP的img-src
指令如下所示:
img-src 'self' https://cdnjs.cloudflare.com
它应该看起来像这样:
img-src 'self' https://cdnjs.cloudflare.com data:
您可以使用 Helmet 设置此策略,如下所示:
app.use(helmet.csp({
directives: {
// ...
imgSrc: ["'self'", "https://cdnjs.cloudflare.com", "data:"]
}
}))