[Vuejs]-Dynamic ejs layout

0๐Ÿ‘

โœ…

<% for(var i=1; i <= Object.keys(post).length ; i++) {%>
    <%if(post['name' + i]){%>
       <div class="name"><%- post['name' + i]%></div>
    <% } %>
<% } %>

Try this, but you should definitely structure your post to be an array of objets so you can easily loop through it.

Leave a comment