我是靠谱客的博主 怕黑戒指,这篇文章主要介绍父传子的驼峰标识,现在分享给大家,希望可以做个参考。

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
    <div id="app">
        <!-- v-bind不能接驼峰命名即字母大写 遇到大写用-转换-->
        <cpn :c-info='info'></cpn>
    </div>

    <template id="cpn">
        <div>
            <h1>{{cInfo}}</h1>
        </div>
            
    </template>

    <script src="../vue.js"></script>
    <script>
        const cpn = Vue.extend({
            template: "#cpn",
            props: {
                cInfo: {
                    type: Object,
                    default(){
                        return {}
                    }
                }
            }
        })
        const app = new Vue({
            el: '#app',
            data: {
                info: {
                    name: 'LSF',
                    age: 20,
                    sex: '男'
                }
            },
            components: {
                cpn
            }
        })
    </script>
</body>
</html>

最后

以上就是怕黑戒指最近收集整理的关于父传子的驼峰标识的全部内容,更多相关父传子内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(111)

评论列表共有 0 条评论

立即
投稿
返回
顶部