[solved] computed fields in styles?



  • Can we use computed fields in styles? I’m not seeing how to anywhere. I have a variable number of q-scroll-areas that all need to fit in a larger box. I’d like to simply have something like:

    style=“height: qsaHeight”

    where qsaHeight = outerBox / numBoxes

    and where outerBox is also calculated



  • :style="computedStyle"
    

    and thend in computed

    computedStyle () {
        return {
            backgroundColor: '#c0c0c0'
        }
    }
    

    Like that. Remember computed properties are treated like vars, not functions
    add as many as you want.
    Use camelCase unless you quote it:
    ‘background-color’: '#c0c0c0`
    etc



  • face palm


Log in to reply