2๐
I think the best way to handle this is to use a computed property.
var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!',
weeks: new Set()
},
computed: {
weeksSize(){
return this.weeks.size
}
}
});
Then you can use your "weeksSize" also in your methods with "this.weeksSize".
Check the documentation for computed property for more informations.
๐คMarcelCode
1๐
You need a computed property in this case.
{
data(){return {weeks: new Set()}},
computed:{numberOfPages:()=>this.weeks.size}
}
https://v3.vuejs.org/guide/computed.html#computed-properties
๐คDropMania
Source:stackexchange.com