首页 > 其他 > 详细

vue生命周期中常用的两个方法

时间:2021-02-04 15:23:49      阅读:37      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>
<body>   
    <div id="app">
        <son></son>
    </div>
    <template id="son">
        <div>
            <h2>子组件</h2>
        </div>
    </template>
    <script>
        new Vue({
            el: #app,
            data: {

            },
            methods: {

            },
            components: {
                son: {
                    template:#son,
                    data(){
                        return{

                        }
                    },
                    methods:{

                    }
                }
            },
            created(){
                debugger
                console.log("created~");

            },
            mounted(){
                debugger
                console.log("mounted~");
            }
        });
    </script>
</body>
</html>

 

技术分享图片

 

 

 

技术分享图片

 

vue生命周期中常用的两个方法

原文:https://www.cnblogs.com/zjazn/p/14371985.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!