Currently in the process of creating a small PWA to simulate an Android app, I have discovered Vuejs.
However, I encountered an issue that has proven difficult to resolve. While scrolling through lists on the homepage for movies, TV shows, or news, clicking on an item resets the scroll position upon returning. Is there a way to retain the scroll position so users can easily navigate back to the same spot?
I've experimented with the keep-alive
property but am struggling to grasp its functionality. Here is how my app page currently appears. I employ :key="$route.fullPath"
to refresh the detail page when moving from one movie to another.
<div id="content">
<keep-alive>
<transition :name="transitionName" mode="out-in">
<router-view :key="$route.fullPath"></router-view>
</transition>
</keep-alive>
</div>
<div class="bottom">
<div class="bottom-bar">
<md-bottom-bar md-type="shift" md-sync-route>
<md-bottom-bar-item id="bottom-bar-item-movies" md-label="Movies" to="/movies"
md-icon="movie"></md-bottom-bar-item>
<md-bottom-bar-item id="bottom-bar-item-tvshows" md-label="TV Shows" to="/tvshows"
md-icon="tv"></md-bottom-bar-item>
<md-bottom-bar-item id="bottom-bar-item-watchlist" md-label="News" to="/news"
md-icon="language"></md-bottom-bar-item>
</md-bottom-bar>
</div>
</div>
A detail page includes a route indicating the type and specific ID, such as /movies/348350
. The page contains a button for navigating back using this.$router.go(-1)
.
Have I overlooked a simple solution to this issue?