<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<div id="app">
    <ul>
        <li v-for="(user, index) in users" :key="user.id">
            index: {{index}} ==> {{user.name}} ==> {{user.age}} ==> {{user.gender}} <br>
            <!-- 1、显示user信息：v-for=“item in items” -->
            <!-- 2、获取数组下标：v-for=“（item，index）in items” -->
            <!-- 3、遍历对象：
                    v-for="value in object"
                    v-for="(value,key) in object"
                    v-for="(value,key,index) in object"
                    -->
            <!-- 4、遍历的时候都加上:key来区分不同的数据，提高vue的渲染效率 -->
            对象信息：
            <span v-for="(v, k, i) in user">{{i}}==>{{k}}==>{{v}};</span>
        </li>
    </ul>
    <ul>
        <li v-for="(num, index) in nums" :key="index">index: {{index}} ==> {{num}}</li>
    </ul>
</div>
<script src="../node_modules/vue/dist/vue.js"></script>
<script>
    // 1. vue声明式渲染
    let vm = new Vue({
        el: '#app',
        data: {
            users: [
                {name: '张三', age: 18, gender: '男'},
                {name: '李四', age: 19, gender: '女'},
                {name: '王五', age: 20, gender: '男'}
            ],
            nums: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
        },
        methods: {
        }
    })
</script>
</body>
</html>
