vue中reset.css的引入问题

673 阅读1分钟

场景

直接访问二级路由地址 [http://localhost:8080/home/reset] 的时候报错:

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

问题分析

public目录下的index.htmllink引入了reset.css文件:

image.png

解决方案

  1. reset.css移到@/assets/css目录下
  2. 进入@/App.vue文件,全局引入@/assets/css:

image.png