Sen descrición

duanbilei 18295a02e4 更新 'README.md' %!s(int64=2) %!d(string=hai) anos
.vscode 7c1504e3cf scss + pinia + axios %!s(int64=3) %!d(string=hai) anos
public 7c1504e3cf scss + pinia + axios %!s(int64=3) %!d(string=hai) anos
src 51a4ad1b47 fix ui %!s(int64=2) %!d(string=hai) anos
.eslintrc.cjs aeeb3853ec 年度投资 %!s(int64=2) %!d(string=hai) anos
.gitignore 7c1504e3cf scss + pinia + axios %!s(int64=3) %!d(string=hai) anos
.prettierrc.cjs aeeb3853ec 年度投资 %!s(int64=2) %!d(string=hai) anos
README.md 18295a02e4 更新 'README.md' %!s(int64=2) %!d(string=hai) anos
index.html 3bd12ea9e4 fix sun %!s(int64=2) %!d(string=hai) anos
jsconfig.json aeeb3853ec 年度投资 %!s(int64=2) %!d(string=hai) anos
package.json aeeb3853ec 年度投资 %!s(int64=2) %!d(string=hai) anos
vite.config.js d0918708b6 fix %!s(int64=2) %!d(string=hai) anos
yarn.lock aeeb3853ec 年度投资 %!s(int64=2) %!d(string=hai) anos

README.md

设置keepAlive

// 配置代码
<route>
  {
    name: '设置',
    meta: { keepAlive: true }
  }
</route>
//
<script>

export default {
  name: '设置', // 需要设置页面name 和 rotue 中的name 一致,keepAlive 才有效
  data () {
    return {
      data: { }
    }
  },
  // ...

// 实现逻辑代码
// /router/index.js
if (to.meta.keepAlive) {
  const keepAlive = keepAliveStore()
  keepAlive.add(to.name) // 将路由名称添加到 keepAlive 集合中
}
// /layout/index.vue
<router-view v-slot="{ Component, route }">
  <keep-alive :include='keepAlive.list'>
    <component :is="Component" :key="route.fullPath" />
  </keep-alive>
</router-view>