Home.vue 649 B

1234567891011121314151617181920212223242526272829303132
  1. <template>
  2. <div class="home">
  3. <h1>首页</h1>
  4. <img
  5. src="https://pic2.zhimg.com/v2-5fb13110e1de13d4c11e6e7f5b8026da_r.jpg"
  6. alt=""
  7. />
  8. <Suspense>
  9. <!-- 具有深层异步依赖的组件 -->
  10. <Child />
  11. <!-- 在 #fallback 插槽中显示 “正在加载中” -->
  12. <template #fallback> Loading... </template>
  13. </Suspense>
  14. </div>
  15. </template>
  16. <script setup>
  17. import { ref, reactive } from "vue";
  18. import Child from "../Suspense/Child.vue";
  19. </script>
  20. <style lang="scss" scoped>
  21. .home {
  22. width: 500px;
  23. height: 500px;
  24. background: yellow;
  25. img {
  26. width: 300px;
  27. height: 300px;
  28. }
  29. }
  30. </style>