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

I just took over a vue3+ts project today. I usually write more about uniapp. Fortunately, I have come into contact with Tencent’s tim framework before. Fortunately, I can still understand it, but I was confused when I saw this.

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

ah! ! ! What does this mean? I know how to use component. I know how to use router-view. I know how to use it. What do they add together? What's the slot?

Understand component dynamic rendering component, slot slot, have used it, router-view, let’s summarize next

Insert image description here

This is the routing router, which means that when the current routing address is login, its component is obtained, which is the Login component, which is the component named Login that is rendered.

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

This is equivalent to how the blogger understands this code. If there is something wrong, please point it out.

Supongo que te gusta

Origin blog.csdn.net/qq_47247479/article/details/129800453
Recomendado
Clasificación