0


router-view v-slot=“{ Component }“

今天刚接手了一个vue3+ts的项目 平时uniapp写的比较多 幸好之前接触过腾讯的tim框架好在还能看懂 但是看到这我懵了

<router-viewv-slot="{ Component }"><component:is="Component"/></router-view>

啊!!!这是什么意思 component我知道怎么用 router-view我知道怎么用加一起是啥? slot个啥?

component动态渲染组件这个理解吧 slot插槽这个理解吧 router-view这个用过吧 接下来上总结

在这里插入图片描述

这是路由router 意思就是当前路由地址为login的时候 获取到他的component 也就是Login组件 也就是渲染名为Login的组件

<router-viewv-slot="{ Login }"><component:is="Login"/></router-view>

相当于这样 博主就是这样理解的这段代码 有不对的地方欢迎指出


本文转载自: https://blog.csdn.net/qq_47247479/article/details/129800453
版权归原作者 奺儿 所有, 如有侵权,请联系我们删除。

“router-view v-slot=“{ Component }“”的评论:

还没有评论