This function can be used to take an HTML string containing Vue Syntax and convert it to a regular HTML string.
-
vueHTML
stringThe HTML string containing Vue Syntax that is to be converted to a regular HTML string.
-
data
Object|nullThe data object that can be referenced in order to render
vueHTML
with the specified data. Ifnull
is given a blank object will be used as the data source. -
onRender
function(html
)The callback function to be called with the resulting rendered HTML string. This is called 1st when the function is called and
vueHTML
is rendered. It is also called ifdata
is changed thusly triggering an update of the rendered HTML.
The Vue
instance that is used to render the desired HTML.
Example run:
vueToHTML(
'<div v-for="a in [1,2,3]">{{a}}</div>',
null,
function(output) {
console.log('Output:', output);
}
);
Another example run:
vueToHTML(
'<div v-for="a in arr">{{a}}</div>',
{ arr: [9,8,7,6,5,4,3,2,1] },
function (output) {
console.log('Output:', output);
}
);