Kak*_*kar 6 vue.js vue-router vuejs2
我的css放在静态目录中.
HTML:
<html>
<head>
<link rel="stylesheet" href="static/font-awesome/css/font-awesome.min.css">
</head>
<body>
<div id="app"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我有嵌套路线
const routes = [
{
path: '/user/:id', component: Profile,
children: [
{
path: 'feeds',
component: ProfileFeeds
},
{
path: 'photos',
component: ProfilePhotos
},
]
},
... some other routes... ,
];
Run Code Online (Sandbox Code Playgroud)
当我在嵌套路由之外时,找到静态文件.但是,当我导航到时user/user_21/feeds,Vue无法找到css.
工作css:
http://localhost:8080/static/font-awesome/css/font-awesome.min.css
Run Code Online (Sandbox Code Playgroud)
变成错误的静态路径:
http://localhost:8080/user/static/font-awesome/css/font-awesome.min.css
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个问题?
如果你用css开头的绝对网址链接/怎么办?
<link rel="stylesheet" href="/static/font-awesome/css/font-awesome.min.css">
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
859 次 |
| 最近记录: |