3

I building a component 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 component 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 component.

Thanks

6
  • stackoverflow.com/q/3492322 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. Commented Jul 24, 2018 at 15:20
  • Perhaps like this <div v-html="my_svg_string"></div><div>{{ my_svg_string }}</div> ? Commented Jul 24, 2018 at 15:22
  • Have you looked at v-html? 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} Commented Jul 24, 2018 at 15:53

1 Answer 1

8

I found a solution!

return createElement('i', {
          domProps: {
            innerHTML: this.data
          }
        }
      )
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.