我在我的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”.
谁能帮忙吗???
我添加<base href="/" />
到html文件的头标签,并且可以正常工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句