Integrate VueJs & Axios to build non blocking UI
Clivern opened this issue · 1 comments
Clivern commented
Integrate VueJs & Axios to build non blocking UI
Clivern commented
<div id="app" class="card">
<div class="card-header">
<h3 class="card-title">Invoices</h3>
</div>
<div class="dimmer" v-bind:class="{ active: isDimmerActive }">
<div class="loader"></div>
<div class="dimmer-content">
<div class="table-responsive">
<table class="table card-table table-vcenter text-nowrap">
<thead>
<tr>
<th class="w-1">No.</th>
<th>Invoice Subject</th>
</tr>
</thead>
<tbody>
<tr v-for="item in items">
<td><span class="text-muted">${item.no}</span></td>
<td>${item.subject}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
kraven_app.load_tabular_data = function(Vue, axios){
return new Vue({
delimiters: ['${', '}'],
el: '#app',
data () {
return {
info: null,
items: [
{ no: '12', subject: "Carl" },
{ no: '13', subject: "Duck" }
],
isDimmerActive: true,
errored: false
}
},
mounted () {
axios
.get('https://api.coindesk.com/v1/bpi/currentprice.json')
.then(response => {
this.info = response
})
.catch(error => {
console.log(error)
this.errored = true
})
.finally(() => this.isDimmerActive = false)
}
});
}