Reputation: 315
<paginate v-model="page" :page-count="pageCount" :container-class="'pagination'" :click-handler="clickCallback(page)" prev-text="‹" next-text="›"></paginate>
...
data: {
page: 1
},
methods: {
clickCallback: async function(page) {
...
}
...
When I click on page in pagination block an error occurs:
[Vue warn]: Invalid prop: type check failed for prop "clickHandler". Expected Function, got Promise.
How to handle it?
Upvotes: 0
Views: 1154
Reputation: 14269
The property does not accept Promises - only synchronous functions. Either wrap your async function inside a synchronous wrapper or put the async part of the function into another function:
<paginate v-model="page" :page-count="pageCount"
:container-class="'pagination'"
:click-handler="clickCallback(page)" prev-text="‹" next-text="›">
</paginate>
...
data: {
page: 1
},
methods: {
clickCallback: function(page) {
...
this.asyncFunction(param1,....);
...
}
asyncFunction: async function(p1)
{
...
}
...
Upvotes: 2