v-html not rendering vue component in Vue 2

后端 未结 1 828
一个人的身影
一个人的身影 2020-12-20 07:54

I am trying render a component using props. But only works when content props is not a component.

Here is an example: https://jsfiddle.net/eugenio4/onf54vt5/

相关标签:
1条回答
  • 2020-12-20 08:05

    No, You can not do this using v-html, as documentation clearly points out:

    Note that the contents are inserted as plain HTML - they will not be compiled as Vue templates.

    The contents are inserted as plain HTML - data bindings/vue components are ignored. Note that you cannot use v-html to compose template partials, because Vue is not a string-based templating engine. Instead, components are preferred as the fundamental unit for UI reuse and composition.

    0 讨论(0)
提交回复
热议问题