VueJs CreateElement() insert dynamic html

拜拜、爱过 提交于 2019-12-23 15:38:06

问题


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


回答1:


I found a solution!

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


来源:https://stackoverflow.com/questions/51502183/vuejs-createelement-insert-dynamic-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!