Nuxt.js: how to use the <keep-alive> in nuxt.js ?

Created on 24 Mar 2017  路  5Comments  路  Source: nuxt/nuxt.js

hi, i has two page,

one is timeline, other is feed-detail

i hope the effect

  1. enter website (default timeline page), load data (feeds) from api-server at hook mounted.

  2. scroll some feeds... click one feed and enter feed-detail page.

  3. click back up button of browser and return timeline page. now timeline reload the feeds and remount the page... scroll on top.

i hope the timeline page is not remount on back up.

i try such as:

<keep-alive>
    <nuxt>
</keep-alive>

but it is no effect, i'm inquisitive what the different between and of vue-router ?

should me to do ?

This feature request is available on Nuxt.js community (#c374)
enhancement question

Most helpful comment

@Atinux hi, i seen the example and have a question:

the home page of example is seem cache the data but the components?

i assume the home page has a long vertical-list ( maybe 100 items ) and the user browsing the 60st. this moment he go home -> about -> home. when he return (or reenter) home page, the page will reload data (no matter where come from server or client-cacheData), the list component of home page will remounted, the user will see from the beginning.

this is a different effect with <keep-alive>

please tell me how to do and implement the effect ? ( I realize the <keep-alive> in client do not work same as in vue/vue-router? )

All 5 comments

how to cache the page-components ?

Hi @kid-wumeng

Please take a look at my answer on this issue: https://github.com/nuxt/nuxt.js/issues/91#issuecomment-269782787

@Atinux hi, i seen the example and have a question:

the home page of example is seem cache the data but the components?

i assume the home page has a long vertical-list ( maybe 100 items ) and the user browsing the 60st. this moment he go home -> about -> home. when he return (or reenter) home page, the page will reload data (no matter where come from server or client-cacheData), the list component of home page will remounted, the user will see from the beginning.

this is a different effect with <keep-alive>

please tell me how to do and implement the effect ? ( I realize the <keep-alive> in client do not work same as in vue/vue-router? )

I'm closing it since it has no activity for a long time and we have to filter the issues since some of them are here for a while. Feel free to re-open after 1.0 release ;)

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danieloprado picture danieloprado  路  3Comments

bimohxh picture bimohxh  路  3Comments

lazycrazy picture lazycrazy  路  3Comments

mikekidder picture mikekidder  路  3Comments

vadimsg picture vadimsg  路  3Comments