mardi 27 mars 2018

nest v-for with axios success in vue

I m new to Vue and currently stuck in a situation let me show my code first then the problem

 <v-select v-model="Productv"  label="product_name" :options="Productdetail"  @input="onClick"></v-select>

when user click on v-select option then onclick method is trigger . suppose if user click dropdown option 2 time than 2 row get create till this every thing work fine

<thead>
  <tr >
      <th class="span2">Product Id</th>
      <th class="span2">Shop Id From</th>
      <th class="span2"> Qty</th>
    </tr>
 </thead>
     <tbody >
        <tr v-for="(col, index) in cols">
            <td>12345</td>
            <td><select class="form-control" v-model="col.select">
            <option>Select Shop</option>
            <option v-for="option1 in options1"></option></select></td>
             <td><input type="number" v-model="col.qty"></td>
        </tr>
     </tbody>
<script>
  methods:{

  getshop(){
    var _this=this
    return this.$http.get('http://localhost:3000/api/companyproducts') .then(function (response) {     
   return _this.t= response.data;
     })
  },
   onClick(){
             var _this=this  
              var x=this.getshop()
              console.log(x)
           // how i can get data from promise 
                     this.cols.push({
                     select:x,
                     qty:0 });
             },

 now my problem is that how i can append getshop function value into select option .above code  work for v-model="Productv"  select but it does not work for

v-model="col.select" select what i m missing any idea



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2pIduTO
via IFTTT

Aucun commentaire:

Enregistrer un commentaire