今天刚接手了一个vue3+ts的项目 平时uniapp写的比较多 幸好之前接触过腾讯的tim框架好在还能看懂 但是看到这我懵了
<router-view v-slot="{ Component }">
<component :is="Component" />
</router-view>
啊!!!这是什么意思 component我知道怎么用 router-view我知道怎么用加一起是啥? slot个啥?
component动态渲染组件这个理解吧 slot插槽这个理解吧 router-view这个用过吧 接下来上总结
这是路由router 意思就是当前路由地址为login的时候 获取到他的component 也就是Login组件 也就是渲染名为Login的组件
<router-view v-slot="{ Login }">
<component :is="Login" />
</router-view>
相当于这样 博主就是这样理解的这段代码 有不对的地方欢迎指出