javascript - VueJs CreateElement() insert dynamic html - Stack Overflow

I building a ponent to convert all icons to SVG. So, at the end of my code I have this:return createEle

I building a ponent to convert all icons to SVG.

So, at the end of my code I have this:

     return createElement('i',
        '<SVG>CODE</SVG>'
      )

Where is this SPAN, I should add a dynamic HTML! I could not find any option to do it. This HTML will be an SVG, so, for this reason, I need to add the full HTML.

Somebody had the same problem? What is missing?? How to make this as new HTML, when my ponent is running???

ps: I dont need to know how to create a SVG file, but yes, how render the HTML, that can be anyone, inside of my dynamic ponent.

Thanks

I building a ponent to convert all icons to SVG.

So, at the end of my code I have this:

     return createElement('i',
        '<SVG>CODE</SVG>'
      )

Where is this SPAN, I should add a dynamic HTML! I could not find any option to do it. This HTML will be an SVG, so, for this reason, I need to add the full HTML.

Somebody had the same problem? What is missing?? How to make this as new HTML, when my ponent is running???

ps: I dont need to know how to create a SVG file, but yes, how render the HTML, that can be anyone, inside of my dynamic ponent.

Thanks

Share Improve this question edited Jul 24, 2018 at 16:01 Quentin 945k132 gold badges1.3k silver badges1.4k bronze badges asked Jul 24, 2018 at 15:15 Cesar CabralCesar Cabral 3414 silver badges13 bronze badges 6
  • stackoverflow./q/3492322 – IVO GELOV Commented Jul 24, 2018 at 15:19
  • I already have my SVG content. I just need to find a way to render my HTML as HTML and as STRING. – Cesar Cabral Commented Jul 24, 2018 at 15:20
  • Perhaps like this <div v-html="my_svg_string"></div><div>{{ my_svg_string }}</div> ? – IVO GELOV Commented Jul 24, 2018 at 15:22
  • Have you looked at v-html? – zero298 Commented Jul 24, 2018 at 15:23
  • is a dynamic element. I think that I can't do that. I found what I need. I should add an attribute: domProps: {innerHTML: this.data} – Cesar Cabral Commented Jul 24, 2018 at 15:53
 |  Show 1 more ment

1 Answer 1

Reset to default 8

I found a solution!

return createElement('i', {
          domProps: {
            innerHTML: this.data
          }
        }
      )

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744057671a4551201.html

相关推荐

  • javascript - VueJs CreateElement() insert dynamic html - Stack Overflow

    I building a ponent to convert all icons to SVG. So, at the end of my code I have this:return createEle

    9天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信