---
url: /docs/5.0/front/other.md
---
# 其他功能

## 页面缓存

页面缓存使用 Vue `<keep-alive>` 组件。项目默认非开启状态，想要开启可以找到这个文件

```javascript
//src\layout\components\content.vue
// 找到下面的代码
 <!--<keep-alive v-if="isKeepalive">
        <component :is="Component" :key="routeKey" />
    </keep-alive>
    <component :is="Component" :key="routeKey" v-else />
-->
<component :is="Component" :key="routeKey" />
```

将注释打开，然后注释掉下面的代码`<component :is="Component" :key="routeKey" />`

还需要找到下面的代码

```javascript
// 大概在 32 行
// const isKeepalive = computed(() => router.currentRoute.value.meta.keepalive)
```

打开注释该注释即可！！！

:::warning
注意 keepalive 组件副作用很多，因为他是将渲染后的页面保存在内存中。页面不会一次渲染，所以对于使用 onMounted 的页面会失效，页面不会重新加载数据
:::
