【发布时间】:2021-08-25 11:47:20
【问题描述】:
`我有一个包含不同插槽的组件,例如:
页眉槽、主槽和页脚槽
基础布局.vue
<template>
<div class="container">
<header>
<slot name="header"></slot>
</header>
<main>
<slot></slot>
</main>
<footer>
<slot name="footer"></slot>
</footer>
</div>
</template>
我有另一个组件(Main)用于渲染到屏幕上。
<template>
<base-layout>
<template v-slot:header>
<h2>Hello world</h2>
</template>
</base-layout>
</template>
Inside Main component I need only to use header slot, instead when I try to do so all the other slots are also getting picked up
【问题讨论】:
标签: vue.js