Open BorisAng opened 4 years ago
Only functions should be passed as event handlers in templates (@
or v-on
). Computed property is used to access the value for which we define a getter (your code above).
Suggested way would be to define a method
, for example, onSeletFilter
and pass it as @select
event handler. onSeletFilter
will receive selected value as an argument that can assigned to update specific defined data
property. Such data
property then can be included in bidsSelectedFilters
computed property. Once data
property is updated, bidsSelectedFilters
will be re-computed and therefore will always provide correct value to be used in API call, etc.
We have 4 dropdowns and the following computed property, which calculates which items from the dropdowns have been selected. The property is then used when emitting events in order to perform some API calls.
Now, when we pass the property to the dropdown's select event like so
@select="bidsSelectedFilters"
we get the following errorThe error makes us think that we cannot pass computed properties to the events, however, we are not sure. Any help will be appreciated!