How to bind long code to a variable in template?


#1

as shown below, cellError(name, index, subfield.name) is long and can’t be handled by computed property.

            <td v-for="(subfield, index) in subfields" :key="index">
                <span v-if="cellError(name, index, subfield.name)" class="error">{{cellError(name, index, subfield.name)}}</span>
            </td>

So is there a way to simplify this? maybe something like v-set:

            <td v-for="(subfield, index) in subfields" :key="index">
                <span v-set="foo=cellError(name, index, subfield.name)" v-if="foo" class="error">{{foo}}</span>
            </td>

#2

I’d like an answer to this too. Seems like maybe the tricks outlined in this thread might be the only way currently-