【发布时间】:2017-07-16 22:01:41
【问题描述】:
我的 css 放在静态目录中。
html:
<html>
<head>
<link rel="stylesheet" href="static/font-awesome/css/font-awesome.min.css">
</head>
<body>
<div id="app"></div>
</body>
</html>
我有嵌套路线
const routes = [
{
path: '/user/:id', component: Profile,
children: [
{
path: 'feeds',
component: ProfileFeeds
},
{
path: 'photos',
component: ProfilePhotos
},
]
},
... some other routes... ,
];
当我在嵌套路由之外时,会找到静态文件。但是,当我导航到 user/user_21/feeds 时,Vue 找不到 css。
工作的 css:
http://localhost:8080/static/font-awesome/css/font-awesome.min.css
变成错误的静态路径:
http://localhost:8080/user/static/font-awesome/css/font-awesome.min.css
我该如何解决这个问题?
【问题讨论】:
标签: vue.js vuejs2 vue-router