9033/vue-front

recursive rendering (VUE)

Opened this issue · 1 comments

9033 commented
recursive rendering (VUE)
9033 commented

components: {
YourComponent: {
name: 'YourComponent',
props: ['title'],
render(h){
let t = []
for(let _t of this.title){
t.push(<p>{_t.name}</p>)
if(Array.isArray(_t.title)){
t.push(<YourComponent title={_t.title}></YourComponent>)
}
}
return (
<main>
{ t }
</main>
)
}
},
},

  • name을 넣으라고 해서 넣으니 됨.
  • 여러 컴포넌트는 배열로 넣으면 됨.
  • 배열로 넣은 컴포넌트는 그대로 괄호안에 지정하면 됨.