3👍
Computed properties can’t take in parameters but technically you can return a function from the computed property that takes in a parameters:
getClassesForDataItem() {
return ui => ui ? 'border-indigo-300 ring-indigo-50' : 'border-gray-300 ring-gray-50';
}
You can also move it to a method, see here for an explanation between the two options.
- [Vuejs]-Vue.js When input elements are present, strange error appears in console
- [Vuejs]-Can't access Vue from js
1👍
Try to return a function with parameters from your computed property :
export default {
computed: {
getClassesForDataItem () {
return (ui, errorClasses) => errorClasses || (ui ? 'border-indigo-300 ring-indigo-50' : 'border-gray-300 ring-gray-50')
}
}
}
- [Vuejs]-How to prevent Malicious POST Requests in a PHP application?
- [Vuejs]-Can not read property "document" of undefined – ApexCharts
Source:stackexchange.com