💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## 作用:可以将组件内容进行传送 ``` <teleport :to="target"> <div>hello</div> </teleport> ``` `to` 是目标的地址 `body` , `#XXX` , `.XXX` 这些都是 `css` 选择器 案列:点击按钮后,改变指向的目标,在不同的容器中渲染组件 ``` <template> <ul> <li class="li_1"></li> <li class="li_2"></li> <li class="li_3"></li> </ul> <teleport :to="target"> <div>hello</div> </teleport> <div> <button @click="target = '.li_1'">传送1</button> <button @click="target = '.li_2'">传送2</button> <button @click="target = '.li_3'">传送3</button> </div> </template> <script> import {ref} from 'vue'; export default { setup() { let target = ref(".li_1"); return { target, }; }, }; </script> ``` ![](https://img.kancloud.cn/c9/f1/c9f1f3194d91c2b3e9f2f3d6d678ceb1_375x209.png) ![](https://img.kancloud.cn/eb/2e/eb2ede7603123b5d2b6cf0bac8eb83b9_389x232.png)