Answer the question
In order to leave comments, you need to log in
VUE.JS createElement - how to use html entities in render function?
An essence in what - created a component. It is necessary to use the render function, since the template capabilities are not enough (complicated rendering logic). Faced with the fact that when I try to transfer some text for display through the properties, everything is fine until I use html entities and just html. This is in the case of rendering according to the template proposed in the documentation
render: function (createElement) {
return createElement('div', {}, ['blabla']) // нормально
}
render: function (createElement) {
return createElement('div', {}, ['blabla ']) //ненормально (для меня), прямо так и выводит
}
render: function (createElement) {
return createElement('div', {domProps:{innerHTML:'blabla '}}, []) //нормально
}
render: function (createElement) {
return createElement('div', {domProps:{innerHTML:'blabla '}}, [
createElement('div', 'child div1'),
createElement('div', 'child div2'),
])
}
Answer the question
In order to leave comments, you need to log in
It is necessary to use the render function, as template capabilities are not enough
all child elements just disappear,
innerHTML
simply overwrites the component's entire child tree.You can, of course, pervert by nesting extra span tags
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question