10.生命周期 (VUE全栈开发学习笔记)

2021-05-10  本文已影响0人  笑着字太黑
生命周期.png

以下代码,测试生命周期函数在各种情况下是否被调用

   beforeCreate(){
        console.log("==beforeCreate==");
        console.log(this.$el);
        console.log(this.$data);
    },
    created(){
        console.log("==created==");
        console.log(this.$el);
        console.log(this.$data);
    },
    beforeMount(){
        console.log("==beforeMount==");
        console.log(this.$el);
        console.log(this.$data);
    },
    mounted(){
        console.log("==mounted==");
        console.log(this.$el);
        console.log(this.$data);
    },
    beforeUpdate(){
        console.log('=beforeUpdate=');
        console.log(this.$el);
        console.log(this.$data);
    },
    updated(){
        console.log('==updated==');
        console.log(this.$el);
        console.log(this.$data);
    },
    beforeDestory(){
        console.log("==beforeDestory==");
    },
    destoryed(){
        console.log("==destoryed==");
    }
上一篇下一篇

猜你喜欢

热点阅读