使用React-Router在React中使用实例的URL问题

mori30r

在我的React项目中使用react-router-dom,一切都很好,直到我再添加一个像这样的Route

<Route path="/edit/:id" component={EditPage}/>

然后我将浏览器中的Url更改为http://localhost:8080/edit/123不呈现任何内容,并在控制台中显示以下警告:

GEThttp://localhost:8080/edit/bundle.js
[HTTP/1.1 404 Not Found 19ms]

The resource from “http://localhost:8080/edit/styles.css” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
123
The resource from “http://localhost:8080/edit/bundle.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
123
The resource from “http://localhost:8080/edit/scripts/bundle.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
123
Loading failed for the <script> with source “http://localhost:8080/edit/scripts/bundle.js”. 123:9:1
GEThttp://localhost:8080/edit/bundle.js
[HTTP/1.1 404 Not Found 3ms]

The resource from “http://localhost:8080/edit/bundle.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
123
Loading failed for the <script> with source “http://localhost:8080/edit/bundle.js”.

谁能帮忙吗???

mori30r

我添加<base href="/" />到html文件的头标签,并且可以正常工作。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章