一、Vue3 中 Teleport 的作用是什么?
    将一个元素挂载到一个指定的dom元素上;示例:

    1. <body>
    2. <div id="app" style="position: relative;">
    3. <h3>Tooltips with Vue 3 Teleport</h3>
    4. <div>
    5. <modal-button></modal-button>
    6. </div>
    7. </div>
    8. const app = Vue.createApp({});
    9. app.component('modal-button', {
    10. template: `
    11. <button @click="modalOpen = true">
    12. Open full screen modal! (With teleport!)
    13. </button>
    14. <teleport to="body">
    15. <div v-if="modalOpen" class="modal">
    16. <div>
    17. I'm a teleported modal!
    18. (My parent is "body")
    19. <button @click="modalOpen = false">
    20. Close
    21. </button>
    22. </div>
    23. </div>
    24. </teleport>
    25. `,
    26. data() {
    27. return {
    28. modalOpen: false
    29. }
    30. }
    31. })
    32. app.mount('#app')
    33. </body>

    二、说一下vue3的composition api?
    函数式编程,提供了一些列新的api