Last active
July 23, 2019 15:17
-
-
Save Konafets/3e5f94af8d9c737e104b90c2f08c4be9 to your computer and use it in GitHub Desktop.
Watching child component computed properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<table-component | |
:data="[ | |
{ firstName: 'John', birthday: '04/10/1940'}, | |
{ firstName: 'Paul', birthday: '18/06/1942'}, | |
{ firstName: 'George', birthday: '25/02/1943'}, | |
{ firstName: 'Ringo', birthday: '07/07/1940'}, | |
]" | |
sort-by="firstName" | |
sort-order="asc" | |
ref="table" | |
> | |
<table-column show="firstName" label="First name"></table-column> | |
<table-column show="birthday" label="Birthday" :filterable="false" data-type="date:DD/MM/YYYY"></table-column> | |
<template slot="tfoot"> | |
<th> </th> | |
<th>Total: {{ sum }}</th> | |
</template> | |
</table-component> | |
</template> | |
<script> | |
// some code | |
data() { | |
return { | |
sum: 0, | |
} | |
}, | |
mounted() { | |
this.$watch(() => this.$refs.table.displayedRows.length, (value) => { this.sum = value;}) | |
}, | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment