form {
position: relative;
}
form.loading ::before {
position: absolute;
width: 100%;
height: 100%;
content: 'Loading...';
background: rgba(25, 25, 25, 0.5);
color: white;
padding: 20px;
}
Vue.component('x-button', {
props: ['text'],
template: `
<button
type="submit"
class="btn btn-primary"
v-on:click="$emit('submit-form', 'loading')">
{{ text }}
</button>
`
});
var vue = new Vue({
el: "#app",
data: {
formClass: ''
},
methods: {
changeFormState: function(className) {
this.formClass = className;
}
}
})