A
A
Anton Golubkov2019-04-03 10:45:30
JavaScript
Anton Golubkov, 2019-04-03 10:45:30

What's wrong with select'a binding on vue?

It seems that I do everything according to the manual, but the data from the select is not pulled into data:

<select v-model='currentOrder' @change='onChange'>
                    <option v-for="(order, key) in orders" v-bind:key="key" v-bind:value="order.ID">{{order.NAME}}</option>
                </select>

document.addEventListener('DOMContentLoaded', function(){
  var returnApp = new Vue({
    el: '#return_app',
    data: function(){
      return{
        orders: window.OW.returnData.ORDERS,
        allErrorArray: [],
        currentOrder: null,
      }
    },
    methods:{
      onChange:function(event){
        console.log(event.target.value);
      }
    }
  });
});

What and where should be corrected?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Proskurin, 2019-04-03
@Gwynbleidd44

I think you are looking at it wrong. The select value is normally set to data.currentOrder, you can see for yourself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question