Templates vuejs模板,包括内部html

Templates vuejs模板,包括内部html,templates,vue.js,components,Templates,Vue.js,Components,我有一个自定义组件,我希望它打印给定的html <customComponent> <p>I want this to be shown at bottom of the created template</p> </customComponent> 我想这是显示在底部创建的模板 看起来很简单,但我找不到任何信息/示例。在您的“CustomComponent.vue”中: props: { text: String } 它的模板是:

我有一个自定义组件,我希望它打印给定的html

<customComponent>
  <p>I want this to be shown at bottom of the created template</p>
</customComponent>

我想这是显示在底部创建的模板


看起来很简单,但我找不到任何信息/示例。

在您的“CustomComponent.vue”中:

props: {
  text: String
}
它的模板是:

<template>
  <p>{{text}}</p>
</template>

{{text}}

您可以这样包括它:


在“CustomComponent.vue”中:

props: {
  text: String
}
它的模板是:

<template>
  <p>{{text}}</p>
</template>

{{text}}

您可以这样包括它:

您可以使用

在customComponent.vue中:

<template>
  <slot></slot>
</template>

然后:


我想这是显示在底部创建的模板

您可以使用

在customComponent.vue中:

<template>
  <slot></slot>
</template>

然后:


我想这是显示在底部创建的模板


我不需要道具,因为我想在real app.Thx中显示很多html。我不需要道具,因为我想在real app.Thx中显示很多html。