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>
原文地址:https://www.cnblogs.com/mr-pz/p/6015407.html