zoukankan      html  css  js  c++  java
  • Vue中的列表过渡

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Vue中的列表过渡</title>
        <script src="./vue.js"></script>
        <style>
            .v-enter, .v-leave-to {
                opacity: 0;
            }
    
            .v-enter-active, .v-leave-active {
                transition: opacity 1s;
            }
        </style>
    </head>
    <body>
    <div id="root">
        <transition-group>
            <div v-for="(item,index) of list" :key="item.id">
                {{item.title}}
            </div>
        </transition-group>
        <button @click="handleBtnClick">Add</button>
    </div>
    <script>
        var count = 0;
    
    
        var vm = new Vue({
            el: '#root',
            data: {
                list: []
            },
            methods: {
                handleBtnClick: function () {
                    this.list.push({
                        id: count++,
                        title: 'hello world'
                    })
                }
            }
        })
    </script>
    </body>
    </html>
  • 相关阅读:
    模板
    模板
    模板
    模板
    2017-2018 ACM-ICPC Asia Tsukuba Regional Contest
    牛客
    软件工程
    Codeforces Round 696(Div.2)
    Atcoder ARC111 contest
    Codeforces Educational Round 100(Div.2)
  • 原文地址:https://www.cnblogs.com/xuyxbiubiu/p/10021206.html
Copyright © 2011-2022 走看看