hoony's web study

728x90
반응형


오늘은 신규로 row 를 생성하고 삭제하는 화면을 생성하고 있는데 인터넷에서 검색해서 넣은 것이 
잘 먹지를 않더군요. 

이럴때 vue에서 사용하는 방법입니다.
이 방법은 javascript 에서도 잘 적용이 될 것 같습니다.

삭제하는 row의 인덱스를 이용해서 삭제를 했는데 이상한 row가 삭제가 되더라구요. 
이럴경우에 적용하는 방법입니다.

this.orderList.splice(this.orderList.indexOf(row), 1);

인넥스에 indexOf를 사용해서 삭제를 해주면 버그없이 해당되는 row가 삭제가 됩니다.
오늘도 좌충우돌하면서 배우게 된것을 포스팅합니다.

검색해서 참고한 URL 은 아래와 같습니다.
https://stackoverflow.com/questions/42845721/remove-item-from-array-in-vue/52153012

 

Remove item from array in Vue

I have the following task list app. I am trying to implement a delete function. I get I need to use splice to remove the item from the array but how do I target only the item whose button I clicked...

stackoverflow.com

 

728x90

공유하기

facebook twitter kakaoTalk kakaostory naver band
loading