关于vue页面通过解决方案

方案一:使用keep-alive和v-if (备注:这种方案有问题,关闭面板后,在通过菜单打开页面还是有缓存)

1、添加keep-alive

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

2、在路由中添加缓存字段

		path:'XXx',
        name:'XXXX',
        component: () => import('.XXX'),
        meta: {
          title:'XXX',
          keepAlive: true
        }

方案二:使用keep-alive和v-if (无方案一中的问题)

1、添加keep-alive

<keep-alive>
          <router-view class="um-view" v-if="$route.meta.keepAlive" :key="$route.fullP

发表回复