使用vue-router的history模式后,assetsPublicPath定位错误,有什么办法可以解决吗?
// router 配置
const HistoryTest = () => import('@/components/HistoryTest')
Vue.use(Router)
export default new Router({
mode: 'history',
routes: [
{
path: '/root/file',
name: 'HistoryTest',
component: HistoryTest,
},
],
})
// HistoryText组件中
<img src="static/logo.png" alt="">
// 实际请求的URL
Request URL:http://localhost:48080/root/static/logo.png
应该是
<img src="static/logo.png" alt="">
,少了个/