在vue项目index.html中引入第三方css和js 报MIME type问题

新手上路,请多包涵

Refused to apply style from 'http://localhost:8081/src/content/loginBackground/css/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled

这是什么原因?该如何解决?

阅读 24.8k
3 个回答

楼主先确认下, 'http://localhost:8081/src/content/loginBackground/css/style.css' 这个文件是否可以直接在浏览器里浏览,我认为应该是这个文件没有找到吧,文件访问路径的问题。

你在引入的地方把reltype属性和属性值加上,这个可能是你定义这个属性得时候定义错误,定义成text/html

后端配置 url 为 /src/content/loginBackground/css/style.css的接口,返回 style.css文件,因为后端返回的html文件引用了该域名下得css文件,作为独立资源加载

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题