1. <template>
    2. <div>
    3. home
    4. </div>
    5. </template>
    6. <script setup>
    7. import {onMounted} from 'vue'
    8. //可以将不同的逻辑拆分开成多个onMounted,不会被覆盖
    9. onMounted(()=>{
    10. setTimeout(()=>{
    11. console.log("http01")
    12. },2000)
    13. })
    14. onMounted(()=>{
    15. setTimeout(()=>{
    16. console.log("http02")
    17. },3000)
    18. })
    19. </script>