When we use Options API, we can define some properties in the computed
section and some properties in the data
section. All of them become accessible from the instance through the this
reference, i.e. in the same object. It's very suitable.
For example:
if (this.hasMore) {
this.loading = true;
...
}
Where hasMore
is a computed property, loading
is a reactive property.
Is there any possibility to do something similar via Composition API? For example, to implement similar code, but where pagination
is a simple object, not a link to a component, like:
if (pagination.hasMore) {
pagination.loading = true;
...
}
The computed
is not solution at all, because it returns ref
and its using will be completely different than using of this
in the example above.