• Vue之For循环


    <!DOCTYPE html>
    <html>
    
    <head>
        <meta charset="utf-8">
        <title>Vue 示例</title>
    </head>
    
    <body>
        <!-- <ul v-for="book in books" :key='index'>
            <li>{{book.name}}</li>
        </ul> -->
        <div id="app">
            <ul v-for="(item,index) in books" :key='index'>
                <li>{{item.name}}</li>
            </ul>
        </div>
        <script src="https://unpkg.com/vue/dist/vue.min.js"></script>
        <script>
            var app = new Vue({
                el: '#app',
                data() {
                    return {
                        books: [{ name: 'asda' }, { name: 'asdas' }],
                    }
                }
                // computed: {
                //     classes: function () {
                //         return {
                //             active: this.isActive && !this.error,
                //             'text-fail': this.error && this.error.type ==='fail'
                //         }
                //     }
                // }
    
                //    computed: {
                //        fullName: {
                //            // Getter, 用于读取
                //            get: function () {
                //                return this.fistName + ',' + this.lastName;
                //            },
                //            // Setter,写入时触发
                //            set: function (newValue) {
                //                 var names = newValue.split(',');
                //                 this.fistName = names[0];
                //                 this.lastName = names[names.length - 1];
                //            }
                //        }
                //    } 
            })
        </script>
    </body>
    <style>
        .active {
            color: red !important
        }
    
        .abc {
            color: beige
        }
    </style>
    
    </html>
    

      

    新鲜刺激的东西永远都有,玩之前掂量掂量自己几斤几两
  • 相关阅读:
    Storm 第一章 核心组件及编程模型
    四 Hive整合HBase
    Hbase第五章 MapReduce操作HBase
    swift 附属脚本
    swift 方法
    swift 属性
    swift 类和结构体
    swift 枚举类型
    swift 闭包
    Swift 函数
  • 原文地址:https://www.cnblogs.com/banxianer/p/13691710.html
Copyright © 2020-2023  润新知