先看图说话,vue
报错
Refused to apply style from ‘http://xxxstatic/css/chunk-elementUI.ded27da0.css’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.
GET http://192.168.xxx/static/js/app.d42ea2ce.js net::ERR_ABORTED 404 (Not Found)
问题来源于刚点击进去的时候是好的,但是刷新页面就会报错
解决方法
const createRouter = () =>
new Router({
mode: 'hash', // 这里改为 hash 就可以了
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})
history hash 两种模式区别可以去查资料了解