search

Home  >  Q&A  >  body text

javascript - How to get the values ​​in the input box looped out by v-for after clicking it and submit it

It's about like this. I'm currently working on an evaluation function that allows multiple products to be evaluated together in one order, but the interface can only interface with the submission of one product per product

 <p v-for="i in orders.item" style="margin-bottom:20px;overflow:hidden">
   <group style="margin-top:-1.17647059em;background:#fff" >
     <radio :options="radio001"  class="pj_radio"></radio>
    <x-textarea  class="pl_text" v-model="value" placeholder="评论内容......"></x-textarea>
   </group>
  <group style="margin-top:-0.6em;background:#fff" >
  <cell-box>评分</cell-box>
  <cell title="总体评分">
  <rater v-model="data3" slot="value" active-color="#771ec8" star="★"></rater>
  </cell>
  </group>
<p @click="aaa(i)"></p>
  </p>

If I have 3 products, I would like to know how to click a button to submit these 3 products together, which will give me an array like this
Products: {
xx:xxx,
xxx:xxx
}
Using the vux plug-in
Or how can I click a button and trigger that aaa(i), which is equivalent to triggering 3 times. Every cycle will be triggered and he can get that i himself. value

淡淡烟草味淡淡烟草味2714 days ago776

reply all(1)I'll reply

  • 巴扎黑

    巴扎黑2017-06-12 09:31:09

    Your V-model should correspond to an object,
    such as this

    <rater v-model="data[index]" slot="value" active-color="#771ec8" star="★"></rater>

    data corresponds to different products, get the index in v-for

    v-for="(i,index) in orders.item" 

    Put your click event outside the loop. When you click submit, just find this data

    reply
    0
  • Cancelreply