Uni-app 之组件的生命周期

一、代码

<template>
    <view>
        
    </view>
</template>

<script>
    export default {
        name:"child",
        data() {
            return {
                
            };
        },
        props: {
            
        },
        beforeCreate() {
            console.log('实例开始初始化');
        },
        created() {
            console.log('组件初始化完成');
        },
        beforeMount() {
            console.log('准备开始挂在页面元素');
        },
        mounted() {
            console.log('组件挂在完成');
            //在下次 DOM 更新循环结束之后执行延迟回调
            this.$nextTick(function(){
                
            })
        },
        beforeUpdate() {
            console.log('数据发生变化');
        },
        updated() {
            console.log('数据渲染完成');
        },
        beforeDestroy() {
            console.log('组件开始销毁')
        },
        destroyed() {
            console.log('组件已被销毁')
        },
        methods: {
            
        }
    }
</script>

<style>

</style>

 

posted @ 2022-11-26 16:39  样子2018  阅读(99)  评论(0编辑  收藏  举报