v-model does not work in vuejs

Asked

Viewed 178 times

0

In a simple test in Vue.Js, following the example of documentation, span never displays the data selected by select.

select is mounted by Vue, but the variable select is not mirror.

    <div class="row" id='vue'>
       <select v-model="selected">
         <option v-for="option in options" v-bind:value="option.value">
           @{{ option.text }}
         </option>
       </select>
       <span>Selected: @{{ selected }}</span>
    </div>

   <script>
     new Vue({
        el: '#vue',
        data: {
            selected: 'A',
            options: [{
                    text: 'One',
                    value: 'A'
                },
                {
                    text: 'Two',
                    value: 'B'
                },
                {
                    text: 'Three',
                    value: 'C'
                }
            ]
        }
    })
   </script>

I’m using @{{ because it is an implementation in Laravel.

1 answer

2


I found that this is some conflict with Jqmigrate and is only locking the selects, has nothing to do with vuejs.

To find out this, I tested the v-mode on another element and it worked, just as if I remove Jqmigrate, select itself works normally.

I have not solved the conflict yet, but as the issue is vuejs, I will consider solved and leave here to facilitate the life of the next.

On the console, there is this alert:

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.