Skip to content

求教:非构建创建组件时,如何使用 ID 选择器来指向一个元素,使用其内容作为模板来源? #7705

Discussion options

You must be logged in to vote

就是在 HTML 中使用 <template> 元素定义模板,如下所示:

<template id="my-template-element">
  <div>{{ count }}</div>
</template>

然后把 my-template-element 这个 id 传给你上面提供的图片的 template 属性。前面别忘了带上 # 字符。

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@crestin
Comment options

@zhangzhonghe
Comment options

@crestin
Comment options

@zhangzhonghe
Comment options

Answer selected by crestin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants