vuejs v-bind

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>vue</title>

     <!-- 
    <script src="vue.js"></script>
    -->
    
 <script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<body> 

<div id="app">
    <ol>
    <vvvv v-for="xxxx in datalists" v-bind:pr="xxxx"></vvvv>     
    </ol>
</div>

<script type="text/javascript">
 
    Vue.component("vvvv",{    
        props: ['pr'],
        template :"<li> {{pr.con}}</li>"

    })

    var app =new Vue({
    el:'#app',
    data:{
        datalists:[{con:"from user A"},{con:"from user B"}]
    }
    })
 
</script>
</body>
</html>

 

posted on 2017-03-21 17:14  rojas  阅读(205)  评论(0编辑  收藏  举报