728x90
배열을 통해 처리를 할게 있다면 v-for를 이용한다.
<select class="form-control" v-model="region">
<option :key="i" :value="d.v" v-for="(d,i) in options">{{ d.t }}</option>
</select>
</div>
</template>
<script>
export default {
data() {
return {
title: "개발자의 품격",
title2: "Seoul",
input1: "abcd",
options: [
{v: "S", t: "Seoul"},
{v: "J", t: "Jeju"},
{v: "B", t: "Busan"}
],
region: "B" // v-model을 통해 (셀렉트 콤보박스가 제일 먼저 부산이 나옴)
};
},
728x90
'JavaScript > Vue' 카테고리의 다른 글
v-if, v-show (0) | 2021.03.15 |
---|---|
이벤트 @click, @change ,v-for (0) | 2021.03.15 |
watch 란? (0) | 2021.03.15 |
Vue 라이프사이클 (좀 더 자세히) (0) | 2021.03.15 |
Vue 기본 구성, router (0) | 2021.03.15 |