Skip to content

[vue] 跟keep-alive有关的生命周期是哪些?描述下这些生命周期 #551

Open
@haizhilin2013

Description

@haizhilin2013
Collaborator

[vue] 跟keep-alive有关的生命周期是哪些?描述下这些生命周期

Activity

heny

heny commented on Jul 5, 2019

@heny

activated和deactivated两个生命周期函数
当keep-alive组件激活时,触发activated,keep-alive组件停用时调用deactivated

encountermm

encountermm commented on Jul 15, 2019

@encountermm

activated和deactivated

  • keep-alive的生命周期
    1.activated: 页面第一次进入的时候,钩子触发的顺序是created->mounted->activated
    2.deactivated: 页面退出的时候会触发deactivated,当再次前进或者后退的时候只触发activated
crush2020

crush2020 commented on Jan 25, 2021

@crush2020

当组件在 内被切换,它的 activated 和 deactivated 这两个生命周期钩子函数将会被对应执行。被 keep-alive 缓存的组件激活时activated调用。被 keep-alive 缓存的组件停用时deactivated调用。

igauch

igauch commented on Jun 17, 2021

@igauch

activated和deactivated

  • keep-alive的生命周期
    1.activated: 页面第一次进入的时候,钩子触发的顺序是created->mounted->activated
    2.deactivated: 页面退出的时候会触发deactivated,当再次前进或者后退的时候只触发activated

当再次前进或者后退的时候也会触发deactivated吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @haizhilin2013@igauch@encountermm@heny@crush2020

        Issue actions

          [vue] 跟keep-alive有关的生命周期是哪些?描述下这些生命周期 · Issue #551 · haizlin/fe-interview