zoukankan      html  css  js  c++  java
  • vue自定义组件的递归

    1、设置一个div显示数值(这个数值不要设置在组件内部)

    2、设置组件的名字

    <!DOCTYPE html>
    <html>
    
    <head>
        <title> hello world vue </title>
        <meta charset="utf-8" />
    </head>
    
    <body>
        <div id="app" v-cloak>
            <!-- 给子组件的变量赋值为1 -->
            <child-component :count="3"></child-component>
    
        </div>
    </body>
    
    </html>
    
    <script src="jquery-3.1.1.js"></script>
    <script src="vue.js"></script>
    
    
    <script>
        $(document).ready(function() {
    
        });
    </script>
    
    
    <script>
        Vue.component('child-component', {
            template: '<div> <child-component  :count = "count+1" v-if="count<100"></child-component> {{count}} </div>',
            name: 'child-component',
            props: {
                count: {
                    type: Number,
                    default: 5
                }
            },
            data: function() {
                return {}
            },
            methods: {}
        });
    
        var app = new Vue({
            el: '#app',
            data: {},
            computed: {},
            methods: {},
            components: {},
            mounted: function() {}
        });
    </script>
  • 相关阅读:
    JavaScript基础
    Dao的扩展
    错题解析
    实现windows程序的数据绑定
    C#第三章
    第二章
    初始windows程序
    使用ADO.NET查询和操作数据
    使用ADO.NET访问数据库
    4.计算机层次与编程语言
  • 原文地址:https://www.cnblogs.com/qqhfeng/p/11481664.html
Copyright © 2011-2022 走看看