No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    [solved] computed fields in styles?

    Help
    2
    3
    118
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rconstantine last edited by rconstantine

      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

      1 Reply Last reply Reply Quote 0
      • Hawkeye64
        Hawkeye64 last edited by Hawkeye64

        :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

        1 Reply Last reply Reply Quote 0
        • R
          rconstantine last edited by

          face palm

          1 Reply Last reply Reply Quote 0
          • First post
            Last post