2016-06-08 4 views
0

저는 폴리머가 새롭고이 도구에 심각한 문제가 있습니다. 가장 최근에 다차원 객체에 요소를 추가하려고했습니다. 나는 내가 선택한 개체의 입력에 새로운 요소를 추가 할 수있는 기능을 구현하려는폴리머로 다차원 객체에 값을 추가하는 방법은 무엇입니까?

tabArrayTest: { 
     type: Object, 
     value: [{ 
       tabName:"visita1", 
       inputs: [{value:"", placeholder:"t1_input1"}] 

       }, 
       { 
       tabName:"visita2", 
       inputs: [{value:"", placeholder:"t2_input1"}] 
       }, 
       { 
       tabName:"visita3", 
       inputs: [{value:"", placeholder:"t3_input1"}] 
       }, 
        { 
       tabName:"visita4", 
       inputs: [{value:"", placeholder:"t4_input1"}] 
       }] 
    } 

다음과 같이

나는 객체를 선언했다. 다음과 같은 결과가 발생했습니다.

tabArrayTest: { 
     type: Object, 
     value: [{ 
       tabName:"visita1", 
       inputs: [{value:"", placeholder:"t1_input1"},{value:"", placeholder:"t1_input2"},{value:"", placeholder:"t1_input3"}] 

       }, 
       { 
       tabName:"visita2", 
       inputs: [{value:"", placeholder:"t2_input1"}] 
       }, 
       { 
       tabName:"visita3", 
       inputs: [{value:"", placeholder:"t3_input1"}] 
       }, 
        { 
       tabName:"visita4", 
       inputs: [{value:"", placeholder:"t4_input1"}] 
       }] 
    } 

이 방법이 가능합니까?

답변

1

당신이 중 하나를 사용한다 폴리머의 예를 들어 array mutation methods

:

pushInputToTab: function (tabIndex, newInput) { 
    this.push('tabArrayTest.' + tabIndex + '.inputs', newInput); 
} 
+0

감사의 앨런, 즉 방법입니다 ... –

관련 문제