I read the docs, also read similar post but still don't get it
This the the warn which i get it
Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value.
Child component:
<div>
<v-container class="ma-0 pa-0">
<v-col class="pa-0" cols="8">
<v-text-field
class="search-field ma-0"
flat
color="black"
:label="$t('keyWord')"
v-model="searchKeyWord"
@click:clear="clearFilterByKeyWord"
clearable
></v-text-field>
</v-col>
</v-row>
<v-btn
depressed
class="black--text my-10 rounded-0"
color="primary"
@click="globalFilter"
>{{ $t('search_subsidiary') }}</v-btn
>
</v-container>
</div>
</template>
<script>
export default {
props: {
dataValue: {
require: true
},
dataValueOriginalCount: {
require: true
}
},
data() {
return {
searchKeyWord: '',
};
},
methods: {
clearFilterByKeyWord() {
this.searchKeyWord = '';
this.unfilterStoComponents();
},
globalFilter() {
//global function which invoke all on click Search button
if (this.searchKeyWord && this.searchKeyWord !== '') {
this.filterByKeyWord();
}
this.$emit('changeData', this.dataValue);
this.$emit('changeDataOriginal', this.dataValueOriginalCount);
},
}
};
</script>
Parent component:
<v-data-table
:headers="headers"
:items="stoSystems"
v-show="isLoading"
v-if="areResultsVisible"
@dataValue="stoSystems = event"
@dataValueOriginalCount="originalstoSystemsCount = event"
>
<template v-slot:item.name="{ item }">
<td >
{{ item.name }}
</td>
</template>
</v-data-table>
<script>
export default {
data() {
return {
headers: [
{
text: this.$t('id'),
value: 'id'
},
{
text: this.$t('nav_item_systems'),
value: 'name',
sortable: false
},
],
Systems: [],
originalstoSystemsCount: [],
};
},
async mounted() {
try {
let res = await axios.get('blbalbla/systems');
this.Systems = res.data;
this.originalstoSystemsCount = res.data;
} catch (error) {
console.error(error);
}
}
};
</script>```