zoukankan      html  css  js  c++  java
  • Vue父子组件生命周期

    转载自:https://blog.csdn.net/a8725585/article/details/79092505

    vue父子组件钩子函数触发顺序

    beforeMount后mounted前构造子组件 依次遍历

    beforeCreate-父组件
    create-父组件
    beforeMount-父组件
    beforeCreate-子组件
    create-子组件
    beforeMount-子组件
    beforeCreate-次子组件
    create-次子组件
    beforeMount-次子组件
    mounted-次子组件
    mounted-子组件

    mounted-父组件

    钩子函数发生的事

    beforeCreate-组件刚实例化完成 el 和 data 都为undefined 
    created-组件实例化完成 data 数据有值,Dom还未生成 el没有值

    beforeMount-虚拟Dom已生成 el 和 data 有值 此时显示<span>{{message}}</span>  俗称占坑

    mounted-挂载完成 此时显示 <span>123 </span>

  • 相关阅读:
    stty
    ping
    read
    echo
    grep
    date
    vi与vim编辑器使用
    rename
    netstat
    input输入框的背景图片也可以这样玩
  • 原文地址:https://www.cnblogs.com/wuguanglin/p/theParentAndChildComponentLifeCycleofView.html
Copyright © 2011-2022 走看看