首页 > 代码库 > props验证

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="http://www.mamicode.com/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>

 

props验证