Answer the question
In order to leave comments, you need to log in
How to work with v-model in select set in vue.js?
Good afternoon!
Code example (slightly simplified to make it clearer)
<template>
<div class="container">
<div class="row">
<div class="col-md-12">
<transition name="fade">
<div v-if="data1.length">
<table class="table table-hover">
<tr v-for="(item, i) in data1">
<td>{{item}}</td>
<td>
<select class="form-control" :disabled="data2.length == 0" v-model="selected">
<option>Выберите значение</option>
<option v-for="item in data2" :value="item">{{item}}</option>
</select>
</td>
</tr>
</table>
</div>
</transition>
</div>
</div>
</div>
</template>
<script>
import axios from 'axios'
export default {
data () {
return {
data1: [
'Название организации',
'Улица',
'Дом',
'Описание'
],
data2: [
'Объект',
'Номер дома',
'Статус'
],
selected: [],
}
},
methods: {
}
}
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question