vue-for

作者: linlu_home | 来源:发表于2019-02-27 15:18 被阅读0次
<!-- Vue--v-for -->

<DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Vue.js</title>
    <link rel="stylesheet" href="style6.css">
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>
<body>  
    <div id="vue-app">
    <h1> v-for</h1>
    <h3></h3>
    <p v-for="title in titles">{{ title }}</p>
    <!-- <p v-for="(who,index) in whos">{{ index+1 }}--{{who.name}}--{{who.age}}</p> -->
    <template v-for="(who,index) in whos"><p>{{ index+1 }}--{{who.name}}--{{who.age}}</p></template><!-- 推荐用template包裹,可以避免重复出现 -->

    </div>
    <script src="app8.js"></script>
</body>
</html>
new Vue({
    el:"#vue-app",
    data:{
        titles:["sally","fah","zouzou"],
        whos:[
            {name:"afa",age:12},
            {name:"hk",age:21},
            {name:"sdf",age:23}
        ]
    },
    methods:{
        
    },
    computed:{
    
    }   
});

相关文章

  • vue-for

    Document {{v}} {{vi}} <.u...

  • vue-for

  • 2018-09-11

    第一节 {{val}}---{{inp}} 第二节 vue-for循环 第三节

  • Vue-for循环、循环数组

    Vue中,数组遍历和其他语言语法类似,比如有一个数组: list=['a','b','c','d']现在要遍历这个...

网友评论

      本文标题:vue-for

      本文链接:https://www.haomeiwen.com/subject/turfuqtx.html