mercredi 25 octobre 2017

bind list item array vue data to input value in a form

Hi I have a form and I have a input field in which I have a vue event which allows to take some values and add it to a data a object in the vue js, but I am not able to bind this vue data property to the input value so I would get back when the form is submitted.

My input

<div class="col-md-4">
   <ul>
      <li v-for="item in filterListValueEnArray">
         @
         <button @click.prevent="removeFilterEn(filterListValueEn)">remove</button>
      </li>
   </ul>
   <input type="text" v-model="filterListValueEn" @keydown.enter.prevent="addFilterValEn(filterListValueEn)" name="array" v-bind:value="filterListValueEnArray" class="form-control">
</div>

vue js code

    new Vue({
        el: '#advFilter',

        data: {
            selectFilterType: '',

            filterListValueEn: '',
            filterListValueEnArray: [],
            filterListValueAr: '',
            filterListValueArArray: [],
        },

        methods: {
            addFilterValEn: function(filterListValueEn) {
                this.filterListValueEnArray.push(filterListValueEn);
                this.filterListValueEn = '';

            },
            addFilterValAr: function(filterListValueAr) {
                this.filterListValueArArray.push(filterListValueAr);
                this.filterListValueAr = '';    
            },
            removeFilterAr: function(filterListValueAr) {
                this.filterListValueArArray.pop(filterListValueAr)
            },
            removeFilterEn: function(filterListValueEn) {
                this.filterListValueEnArray.pop(filterListValueEn)
            }
        }
    });

I want to bind the filterListValueEnArray in the value of the text field but I dont get back anything when I do in laravel.

$request->all();

Please assist



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

Aucun commentaire:

Enregistrer un commentaire