F
F
FlooDwm2019-11-30 23:39:47
Vue.js
FlooDwm, 2019-11-30 23:39:47

Why is value not being passed from option?

Component

<template>
           <div class="form-group">
                   <label>Специализация</label>
                <select class="form-control select2bs4" style="width: 100%;" v-model="pr">
                  <option selected="selected" value="1">Стиралки</option>
                  <option value="2">Посудомойки</option>
                  <option value="3">Холодильники</option>
               </select>
              <button type="submit" class="btn btn-block btn-success" @click="submitIt">Начать Сбор</button>
          </div>
</template>

<script>
    export default {
    name: 'reviews-component',
        data(){
            return{
                pr: null
            }
        },
        methods : {
            submitIt: function () {
                console.log(this.pr)
            }
        }
    }
</script>

5de2d35ebaf0b751095697.png
Why null??
v-model must ensure assignment on change.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Kulaxyz, 2019-11-30
@Kulaxyz

5de2d6dc47675144929387.jpeg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question