【发布时间】:2021-10-27 13:01:18
【问题描述】:
有可能吗? 我有这样的事情:
<template>
<my-layout>
<template #header>
Some header html goes here
</template>
Body html here
</my-layout>
</template>
<script>
import MyLayout from './MyLayout.vue'
export default {
layout: MyLayout,
components: {
//MyLayout
}
}
</script>
还有这样的模板
<template>
<div>
<slot name="header"/>
</div>
<slot/>
</template>
默认插槽有效,但“标题”插槽不显示自身(除非使用 MyLayout 作为标准组件)。
【问题讨论】:
-
没有解释如何处理“全局”布局。