Vue Animation

λ·° μ• λ‹ˆλ©”μ΄μ…˜μ€ λ·° ν”„λ ˆμž„μ›Œν¬ μžμ²΄μ—μ„œ μ§€μ›ν•˜λŠ” μ• λ‹ˆλ©”μ΄μ…˜ κΈ°λŠ₯으둜, 데이터 μΆ”κ°€, λ³€κ²½, μ‚­μ œμ— λŒ€ν•΄μ„œ νŽ˜μ΄λ“œ 인, νŽ˜μ΄λ“œ 아웃 λ“± μ—¬λŸ¬κ°€μ§€ μ• λ‹ˆλ©”μ΄μ…˜ 효과λ₯Ό μ§€μ›ν•œλ‹€. 기타 μžλ°”μŠ€ν¬λ¦½νŠΈ μ• λ‹ˆλ©”μ΄μ…˜ λΌμ΄λΈŒλŸ¬λ¦¬λ‚˜ CSS μ• λ‹ˆλ©”μ΄μ…˜ λΌμ΄λΈŒλŸ¬λ¦¬λ„ 같이 μ‚¬μš©ν•  수 μžˆλ‹€.

<transition-group name="list" tag="ul">
            <li v-for="(todoItem,index) in propsdata" v-bind:key="todoItem" class="shadow">
                <i class="checkBtn fa fa-check" aria-hidden="true"></i>{{ todoItem }}
                <span class="removeBtn" type="button" @click="removeTodo(todoItem, index)"><i class="fas fa-trash" aria-hidden="true"></i></span>
            </li>
</transition-group>
<transition-group name="list" tag="ul"></transition-group>

<transition-group> νƒœκ·ΈλŠ” λͺ©λ‘μ— μ• λ‹ˆλ©”μ΄μ…˜μ„ μΆ”κ°€ν•  λ•Œ μ‚¬μš©λ˜λŠ” νƒœκ·Έμ΄λ©°, tagλͺ…을 μ§€μ •ν•˜λ©΄λœλ‹€. name 속성은 CSSν΄λž˜μŠ€μ™€ μ—°κ΄€μžˆλ‹€.

<style>
    .list-item{
        display: inline-block;
        margin-right: 10px;
    }
    .list-move{
        transition: transform 1s;
    }
    .list-enter-active, .list-leave-active{
        transition: all 1s;
    }
    .list-enter, .list-leave-to{
        opacity: 0;
        transform: translateY(30px);
    }
</style>

css μ†μ„±μ˜ 클래슀λ₯Ό 보면 λͺ¨λ‘ μ•žμ—μ„œ μ„€μ •ν•œ name 속성 κ°’(list)을 μ ‘λ‘μ‚¬λ‘œ κ°–κ³  μžˆλ‹€. λ’€μ—μ˜€λŠ” 뢀뢄은 데이터가 λ“€μ–΄κ°€κ³  λ‚˜κ°€λŠ” λ™μž‘μ„ μ •μ˜ν•˜λŠ” CSS이닀.

μ°Έμ‘°

Last updated