3๐
โ
If you need arguments then you want to write a method, not a computed property.
<button :class="styleMinusButton(i)">...</button>
methods: {
styleMinusButton(i) {
const { travelers, curOcc, minOcc } = this
return {
'uk-disabled uk-button-default': travelers[i] == 0 || (curOcc !== 1 && curOcc <= minOcc),
'uk-button-primary': travelers[i] > 0 && (curOcc > minOcc || curOcc >= minOcc && travelers[i] === 1 && travelers[i+1] !== 1 && travelers[i+2] !== 1 && travelers[i-1] !== 1 && travelers[i-2] !== 1)
}
}
}
๐คDecade Moon
Source:stackexchange.com