I am trying to hide the vue.js template's contents before it is fully rendered. Consider following template:
<div class="loader">
<table class="hidden">
<tr v-for="log in logs">
<td>{{log.timestamp}}</td>
<td>{{log.event}}</td>
</tr>
</table>
</div>
When I render this template on the server, the user sees the contents of the <tr>
element before it is rendered. For this reason I use the class hidden
to hide it, before it is fully rendered.
Also before it is rendered, I am showing a loader element with some animated progressbar.
Once it is rendered, I would just call element.show()
in jQuery and hide the progressbar as well. My question is: is it okay to mix jQuery and vue.js to achieve this?
var vueLogs = new Vue({
el: "#checkInLogsHolder",
data: {logs: []}
});
var holder = $("#checkInLogsHolder");
function response(payload) {
// hiding the loader animation
holder.find(".loader").remove();
// showing the rendered table
holder.find("table").show();
vueLogs.logs.unshift(payload);
}
Is there some better way to do this?