Home.vue 543 B

1234567891011121314151617181920212223242526
  1. <template>
  2. <div>
  3. <h2>home</h2>
  4. <button @click="changeShow">切换</button>
  5. <!-- include exclude
  6. :include="['Part1']"
  7. -->
  8. <KeepAlive>
  9. <Part1 v-if="isShow"></Part1>
  10. <Part2 v-else></Part2>
  11. </KeepAlive>
  12. </div>
  13. </template>
  14. <script lang="ts" setup>
  15. import Part1 from "@/components/Part1.vue";
  16. import Part2 from "@/components/Part2.vue";
  17. import { ref, reactive } from "vue";
  18. let isShow = ref(true);
  19. function changeShow() {
  20. isShow.value = !isShow.value;
  21. }
  22. </script>
  23. <style lang="scss" scoped>
  24. </style>