简体   繁体   English

vue中重新加载组件的数据丢失

[英]Lost data on reload component in vue

this's mine project: https://pokedex-vue-sf.netlify.app/这是我的项目: https://pokedex-vue-sf.netlify.app/

when i go on pokemon details and reload page I get 404 page.当我在口袋妖怪详细信息和重新加载页面上的 go 时,我得到 404 页面。 How can I fix that?我该如何解决? I tried with localStorage but I did not succeed我尝试使用 localStorage 但没有成功

  1. It is because you're reloading '/pokemon/bulbasaur' route.这是因为您正在重新加载“/pokemon/bulbasaur”路线。 You must configure your server to serve '/' for all routes.您必须将服务器配置为为所有路由提供“/”。

  2. Or you could toggle your history mode in your vue-router.或者你可以在你的 vue-router 中切换你的历史模式。 This will add a '#' after your base url.这将在您的基础 url 之后添加一个“#”。 Anything after # will not be sent to the server, so you will always be requesting the '/' route. # 之后的任何内容都不会发送到服务器,因此您将始终请求“/”路由。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM