<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/vue.min.js"></script>
</head>

<body>
    <div id="app">
        <ul>
            <li v-for="(item, index) in list" :key="index">{{item}}</li>
        </ul>
        <div>
            <div>{{info.name}}</div>
            <div>{{info.age}}</div>
            <div>{{info.gender}}</div>
        </div>
    </div>
</body>
<script type="text/javascript">
    var vm = new Vue({
        el: '#app',
        data: {
            msg: 'hello',
            list: ['apple', 'orange', 'banana'],
            info: {
                name: 'congshuo',
                age: 12,
            }
        },
        methods: {

        }
    })

    //Vue.set(vm.list, 2, 'lemon');
    vm.$set(vm.list, 1, 'lemon');
    vm.info.gender = 'male';
    vm.$set(vm.info, 'gender', 'female')
</script>

</html>
<!--
    修改响应式数据
        - Vue.set(vm.items,indexOfItem,newValue)
        - Vue.$set(vm.items,indexOfItem,newValue)
            ①   参数一表示要处理的数组名称
            ②   参数二表示要处理的数组的索引
            ③   参数三表示要处理的数组的值
-->