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

    volatile size form

    Help
    3
    6
    139
    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.
    • Z
      zeppelinexpress last edited by

      I have:

      <div class="flex row" v-for="(value, name) in form" :key="name">
        <q-input class="col q-mr-sm" filled dense />
        <q-input class="col" filled dense />
      </div>
      <q-btn color="primary" icon="post_add" class="q-mb-md" label="Add field" />
      
      form: { field1: 'value1', field2: 'value1' }
      

      I want to set field/value, maybe with v-model, but I don’t know how… someone can help?

      metalsadman 1 Reply Last reply Reply Quote 0
      • s.molinari
        s.molinari last edited by

        So, with what you have, you don’t need a v-for.

        If you want to use a v-for, you’d probably want each field’s v-model (and any other data for the field) to be in its own object and then have an array of field objects.

        Try putting a codepen together to get as far as you can and we can collaborate on that.

        Scott

        1 Reply Last reply Reply Quote 1
        • metalsadman
          metalsadman @zeppelinexpress last edited by metalsadman

          @zeppelinexpress v-model="form[name]", https://codepen.io/metalsadman/pen/XWNeyoV?editors=101

          1 Reply Last reply Reply Quote 1
          • Z
            zeppelinexpress last edited by

            thanks guys!, @metalsadman and if I want a button to add fields as needed?

            metalsadman 1 Reply Last reply Reply Quote 0
            • metalsadman
              metalsadman @zeppelinexpress last edited by

              @zeppelinexpress wouldn’t matter, as long as the properties are unique, otherwise just go for an array.

              1 Reply Last reply Reply Quote 1
              • Z
                zeppelinexpress last edited by

                thanks, I did in an ugly way, but at least it’s working

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