Bez popisu

scorpio 70222fd8b9 fix bug před 2 roky
.vscode 7c1504e3cf scss + pinia + axios před 3 roky
public 591a3b4140 fix bug před 2 roky
src 70222fd8b9 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 591a3b4140 fix bug před 2 roky
jsconfig.json aeeb3853ec 年度投资 před 2 roky
package.json 0ff4145e17 fix bug před 2 roky
vite.config.js ba32883d49 fix search před 2 roky
yarn.lock 0ff4145e17 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>