Vue3使用keep-alive实现组件缓存

<template>
  <router-view v-slot="{ Component }">
    <keep-alive :include="includeList">
      <component :is="Component" />
    </keep-alive>
  </router-view>
</template>

<script lang="ts">
import { ref, defineComponent } from "vue";
export default defineComponent({
  name: "App",
  setup() {
    // 需要缓存的组件name值
    const includeList = ref(["index"]);
    return {
      includeList,
    };
  },
});
</script>
上一篇:Linux开发板 - 02 - eop/uboot下载


下一篇:JDBC-Batch 批量执行