I have Vue app with several components. This code is duplicated in every component at the top of its template:
<section v-if="status || warn" class="messages">
<div class="status">{{status}}</div>
<div class="warn">{{warn}}</div>
</section>
and this code in script part of single file component:
data() {
return {
status: '',
warn: ''
}
}
I want to extract this common code into Component named Status.vue and other components import it html part will look like:
<Status></Status>
But I do not know how to handle the data variables: status and warn? status and warn will be set to some strings depending on what response comes from API call to remote service.
Will I need to redeclare these in components where Status component is imported?