How can I add 2 condition in one class vue.js 2?
vue-component, vue.js, vuejs2
Solution
You can use `:class="[array, of, classes]"` syntax:
<a :class="['btn', (respond === 'responseFound' ? 'btn-yellow' : 'btn-default'), (type === 1 ? 'btn-block' : 'btn-xs center-block')]">
As a bonus you don't have to worry about adding the leading spaces, Vue will handle it.
Problem
My vue component is like this : ``` <template> <a :class="'btn ' + [respond == 'responseFound' ? ' btn-yellow' : ' btn-default', type == 1 ? ' btn-block' : ' btn-xs center-block']"> ... </a> </template> ``` I try like that, but it does not work?