vue input data() 관리하기

jeonbang123·2022년 7월 31일
0

vue를 사용하다니까 data를 관리할때
변수명 짓기 최소화하기위해서 Object로 input 파라미터만이라도
쉽게 관리하기위해 생각해냄

input.mixin.js

// TODO computed 감싸기
const param = {}
for(const key in this.input){
  param[key] = this.input[key].value
}

app.vue

/**
*
*/
data() {
  return {
    input : {
      id: {
        value: '',          
      },
      password: {
        value: ''
      },
      category: {
        value: '',
        option: [],
        disabled: false,
      }        
    }
  };
},
// TDOO
// mixin적용하기..
// axios에 파라미터 전달
profile
Design Awesome Style Code

0개의 댓글