I want to display a loading bar inside a div tag and control its display with my custom directive in vuejs.
for example, this is my tag and I want to hide all of the content inside it and only show loading bar inside it.
template :
<div>
<div class="data-container" v-loading-spin="loading">
<!-- my content and other tags here -->
</div>
</div>
loading bar tag:
<div class="loading-spinner">
<!-- my loading bar -->
</div>
JS :
Vue.directive('loading-spin', {
bind: function (el, binding, vnode) {
if (binding.value == true) {
// how to display loading and hide other content
} else {
// how to display content and delete loading bar
}
}
});
how can I do that?
thanks.