I
I
Igor Bezlepkin2018-11-16 15:44:09
Vue.js
Igor Bezlepkin, 2018-11-16 15:44:09

How to loop template in VUE from js code?

Hey! There was a need in the component to add elements to the DOM in the old fashioned way, but since this is a piece of HTML with variables, you need to make a template in js, fill it with variables and do append. Tell me how in Vue in js code you can take an html template, like in mustache.js
var result = Mustache.render(template, data);
output append(result);
and in the loop already add an element to the DOM.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2018-11-16
@Fragster

I'm too lazy, here is a solution with sticking "to the bottom" https://jsfiddle.net/n0rmt92o/29/
adapting to sticking "to the top" is easy, just invert the sticking logic, but IMHO adding new messages from the bottom is more logical.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question