Bez popisu

scorpio 6f85d64394 fix bug před 2 roky
.vscode 7c1504e3cf scss + pinia + axios před 3 roky
public 7c1504e3cf scss + pinia + axios před 3 roky
src 6f85d64394 fix bug před 2 roky
.eslintrc.cjs aeeb3853ec 年度投资 před 2 roky
.gitignore 7c1504e3cf scss + pinia + axios před 3 roky
.prettierrc.cjs aeeb3853ec 年度投资 před 2 roky
README.md 61bbd02f9e fix před 3 roky
index.html 71f886877a fix bug před 2 roky
jsconfig.json aeeb3853ec 年度投资 před 2 roky
package.json 111dbf2049 fix bug před 2 roky
vite.config.js 95fa9bd886 fix bug před 2 roky
yarn.lock 111dbf2049 fix bug před 2 roky

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>