Nessuna descrizione

scorpio f83da77ea0 预览ui 大小 2 anni fa
.vscode 7c1504e3cf scss + pinia + axios 3 anni fa
public 7c1504e3cf scss + pinia + axios 3 anni fa
src f83da77ea0 预览ui 大小 2 anni fa
.eslintrc.cjs d0ac119e71 add eslint 3 anni fa
.gitignore 7c1504e3cf scss + pinia + axios 3 anni fa
README.md 61bbd02f9e fix 3 anni fa
index.html 3bd12ea9e4 fix sun 2 anni fa
package.json 765f2914a0 fix 2 anni fa
vite.config.js ca81b80a4e fix 2 anni fa
yarn.lock 765f2914a0 fix 2 anni fa

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>