zoukankan      html  css  js  c++  java
  • vue 生命周期

    var app = new Vue({
    el: '#app',
    data: {
    message: "xuxiao is boy"
    },
    beforeCreate: function () {
    console.group('beforeCreate 创建前状态===============》');
    console.log("%c%s", "color:red", "el : " + this.$el); //undefined
    console.log("%c%s", "color:red", "data : " + this.$data); //undefined
    console.log("%c%s", "color:red", "message: " + this.message)
    },
    created: function () {
    console.group('created 创建完毕状态===============》');
    console.log("%c%s", "color:red", "el : " + this.$el); //undefined
    console.log("%c%s", "color:red", "data : " + this.$data); //已被初始化
    console.log("%c%s", "color:red", "message: " + this.message); //已被初始化
    },
    beforeMount: function () {
    console.group('beforeMount 挂载前状态===============》');
    console.log("%c%s", "color:red", "el : " + (this.$el)); //已被初始化
    console.log(this.$el);
    console.log("%c%s", "color:red", "data : " + this.$data); //已被初始化
    console.log("%c%s", "color:red", "message: " + this.message); //已被初始化
    },
    mounted: function () {
    console.group('mounted 挂载结束状态===============》');
    console.log("%c%s", "color:red", "el : " + this.$el); //已被初始化
    console.log(this.$el);
    console.log("%c%s", "color:red", "data : " + this.$data); //已被初始化
    console.log("%c%s", "color:red", "message: " + this.message); //已被初始化
    },
    beforeUpdate: function () {
    console.group('beforeUpdate 更新前状态===============》');
    console.log("%c%s", "color:red", "el : " + this.$el);
    console.log(this.$el);
    console.log("%c%s", "color:red", "data : " + this.$data);
    console.log("%c%s", "color:red", "message: " + this.message);
    },
    updated: function () {
    console.group('updated 更新完成状态===============》');
    console.log("%c%s", "color:red", "el : " + this.$el);
    console.log(this.$el);
    console.log("%c%s", "color:red", "data : " + this.$data);
    console.log("%c%s", "color:red", "message: " + this.message);
    },
    beforeDestroy: function () {
    console.group('beforeDestroy 销毁前状态===============》');
    console.log("%c%s", "color:red", "el : " + this.$el);
    console.log(this.$el);
    console.log("%c%s", "color:red", "data : " + this.$data);
    console.log("%c%s", "color:red", "message: " + this.message);
    },
    destroyed: function () {
    console.group('destroyed 销毁完成状态===============》');
    console.log("%c%s", "color:red", "el : " + this.$el);
    console.log(this.$el);
    console.log("%c%s", "color:red", "data : " + this.$data);
    console.log("%c%s", "color:red", "message: " + this.message)
    }
    })
  • 相关阅读:
    【小白建站笔记】从购买域名及服务器到备案成功:以阿里云为例
    jarvisoj-Evil Exe
    jarvisoj-软件密码破解-2(CFF_100_1)
    Jarvis OJ-superexpress
    JarvisOJ-[xman2019]xfz
    csictf-Esrever
    分解质因数
    矩阵乘法
    python获取一组数个位数之和
    python计算字母出现次数
  • 原文地址:https://www.cnblogs.com/yimuzanghua/p/8808165.html
Copyright © 2011-2022 走看看