interview-answe icon indicating copy to clipboard operation
interview-answe copied to clipboard

157.[vue]你怎么理解vue中的diff算法?

Open webVueBlog opened this issue 4 years ago • 1 comments

[vue]

webVueBlog avatar Apr 02 '20 02:04 webVueBlog

virtual dom,也就是虚拟节点,它通过JS的Object对象模拟DOM中的节点,然后再通过特定的render方法将其渲染成真实的DOM节点。

新旧虚拟dom的差异比较方法称为diff算法

简单的说就是新旧虚拟dom 的比较,如果有差异就以新的为准,然后再插入的真实的dom中,重新渲染 特点: 只会做同级比较,不做跨级比较

webVueBlog avatar Apr 02 '20 02:04 webVueBlog