Skip to content

[vue] 你了解vue的diff算法吗? #425

Open
@haizhilin2013

Description

@haizhilin2013
Collaborator

[vue] 你了解vue的diff算法吗?

Activity

wenyejie

wenyejie commented on Jun 27, 2019

@wenyejie

说实话没有阅读过源码

大概说一下自己的猜测:
如一个list中某一个数据发生变更时,
vue中会对整个list进行遍历, 判断使用到的某些属性是否发生变更, 从而更新发生变更的item
所以key属性才会显得很重要, 它会告诉你, 我那个item发生变更, 而不是去检测整个list

censek

censek commented on Nov 1, 2019

@censek
CoderNanT

CoderNanT commented on Oct 7, 2020

@CoderNanT

我的理解:计算出虚拟 DOM 中真正变化的部分,并且只针对该部分进行 DOM 更新,而非重新渲染整个页面

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

        @wenyejie@haizhilin2013@slbyml@censek@CoderNanT

        Issue actions

          [vue] 你了解vue的diff算法吗? · Issue #425 · haizlin/fe-interview