VueJs Component with <template> Tag
VueJs Component with <template> tag to specify the component's template - http://coligo.io
by jorgeluis
HTML
<script src="https://unpkg.com/[email protected]/dist/vue.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/vue.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/buefy.min.css">
<div id="app">
<b-button
:loading="isLoading"
type="button"
class="button is-primary"
@click="makeRequest">
Button label
</b-button>
</div>
JavaScript
const example = {
data() {
return {
isLoading: false
}
},
methods: {
makeRequest: function () {
let self = this
this.isLoading = true
window.setTimeout(function () {
self.isLoading = false
}, 2000)
}
}
}
const app = new Vue(example)
app.$mount('#app')