Reputation: 105
I am trying to create a computed property where it checks item is in the array. So i created this function that returns boolean value and takes one parameter which is the item i will check.
isSelected: function (item: MediaGalleryItemTypes) {
return this.selectedItems.some(e => e._id === item._id)
}
In the template section i have to send the variable to another component, here is how i use it
DocumentCard(:is-selected="isSelected(document)")
The code gives error as
chunk-common.js:5918 Uncaught (in promise) TypeError: _ctx.isSelected is not a function
and in vscode it gives the error as:
This expression is not callable. Type 'Boolean' has no call signatures.
How can i fix this and make a computed property to get a parameter?
Upvotes: 0
Views: 2512
Reputation: 96
You can't pass parameters to computed properties (unless the computed return a function). You can use with the standard method
Can I pass parameters in computed properties in Vue.Js
Upvotes: 1