props验证

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <div id="example" v-once>
        <app :showif="showif"></app>
    </div>
    <script type="text/javascript" src="vue.js"></script>
    <script type="text/javascript">
        Vue.component('app',{
            props:{
                showif: Boolean
            },
            template:'<div v-show="showif">你妹夫</div>',
        })
        var app = new Vue({
            el:'#example',
            data:{
                showif : true
            }
        })
    </script>
</body>
</html>

 

posted @ 2016-10-31 12:07  overAgain  阅读(155)  评论(0编辑  收藏  举报