This is my first project with Vue and I'm a couple of months into it. I have test question content in xml. In some cases the xml contains html. I'm grabbing the xml via ajax and using that content in templates which are built dynamically based on the needs of a particular test question instance. I would like to have reactive inputs in which the user will enter answers and then submit for evaluation. The html and number of inputs in a question varies widely in the data. But an example might look something like this
<item id="q0" type="question">
<text>Complete the data in the table below.
<table>
<tr>
<th>row 1, col 1</th>
<th>row 1, col 2</th>
</tr>
<tr>
<td>row 2, col 1</td>
<td>
<input id="input0"/>
</td>
</tr>
</table>
</text>
<item>
The issue is that I don't know how to create a reactive input and render the surrounding html dynamically.
I tried this type of thing
https://jsfiddle.net/4u5tnw90/9/
but if you add v-html="item" to div#table it breaks. I assume because the html pieces are not legal html. I'm thinking that I'm going to have to parse the text element and create a VNode with createElement for each html element contained within and then render it. But I'm hoping that someone can save me from that fate. Is there another way?