JSFiddle - React, Tailwind, and code Playground
by mogu10
HTML
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<div v-show="loading" class="loader">Now loading...</div>
<div v-show="!loading" class="itemContainer">
<item-component
v-for="(result, index) in results" :key="index"
v-bind:id="result.id"
v-bind:name="result.name"
v-bind:value="result.value"
>
</item-component>
</div>
JavaScript
var app = new Vue({
el: '#app',
data: {
results: [],
loading: true
},
components: {
'item-component': ItemComponent
},
mounted () {
axios
.get("api.php")
.then(response => {
this.results = response.data;
this.loading = false;
})
}
});