Dynamic Components (동적 컴포넌트), :is attribute
조건에 따라 렌더링 되는 html 요소를 변경하고 싶었고 해결방안으로 사용된 Dynamic Components와 :is
상황
<a
v-if="href"
:class="[
'link',
{
round: round,
liner: liner,
icon: icon,
...
},
]"
...props
>
...
</a>
<button
v-else
:class="[
'button',
{
round: round,
liner: liner,
icon: icon,
...
},
]"
...props
>
...
</button>참고링크
Last updated