简体   繁体   中英

Vue keep-alive label not working when setting the keepAlive true

I have three routes in my project, dashboard dashboard_detail and app_score.

I want to keep my data not refreshing again when I return to dashboard through detail page.

<keep-alive v-if="$route.meta.keepAlive">
            <router-view></router-view>
        </keep-alive>
        <router-view v-if="!$route.meta.keepAlive"></router-view>

I had set a variable called 'keepAlive' in the meta label in route>index.js. 在此处输入图片说明

在此处输入图片说明 But the problem is it always refresh when returned.

<keep-alive>
        <router-view v-if="$route.meta.keepAlive"></router-view>
    </keep-alive>
    <router-view v-if="!$route.meta.keepAlive"></router-view>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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