重庆网站建设招聘信息域名查询阿里云
其中一种情况:你为了使用 convertFileSrc
来加载本地资源,按照官方文档在 tauri.conf.json
中 设置了 tauri.security.csp
为 "default-src 'self'; img-src 'self' asset: https://asset. Localhost"
,恰好你在组件中编写了一部分的内联样式,这使得你的组件被内容安全策略所屏蔽。
解决这个问题,在 csp 中加入 'unsafe inline'
即可:
{"security": {"csp": "default-src 'self' 'unsafe-inline'; img-src 'self' 'unsafe-inline' asset: https://asset.localhost"},
}