Sons add data cycle vue

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <Title> circulating </ title>
</head>
<style>
    # Div2 {
        display: inline-block;
    }
</style>

<body>
    <div id="add">
        <div id="div1" v-for="lit in list">
            <P> father: {{lit.name}} Age: {{lit.Age}} Gender: {{lit.Sex}} </ p>
            <div id="div2" v-for="(lt,ind) in lit.child">
                <p v-if="lit.child.length!=0">儿子:{{lt.name}} 年龄:({{lt.Age}}岁)<span v-if="ind!=lit.child.length-1">和</span>
                </p>
            </div>
            <hr>
        </div>
    </div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
    There addr = new Vue ({
        el: '#add',
        data: {
            list: [{
                name: 'peripheral overcast Ting'
                Age: '130',
                Sex: 'male'
                child: [{
                    name: 'skins',
                    Age: 3
                }, {
                    name: 'small oil',
                    Age: 2
                }]
            }, {
                name: 'ocean',
                Age: '24',
                Sex: 'male'
                child: [{
                    name: 'small ocean'
                    Age: 2
                }]
            }, ]
        },
    })
</script>

</html>

Guess you like

Origin www.cnblogs.com/msz8080/p/11752966.html