DEV Community

ChuangWANG
ChuangWANG

Posted on • Updated on

20210503

vue3相对于vue2的一个优化:diff算法的变动
vue2对所有的元素进行diff
vue3只对会发生的动态变化的元素进行diff
vue3对会发生动态变化的元素增加一个标记。只有含有这个标记的元素才会进行diff.
Bellow is the flag which will be attached:
image
image

// output: 8
console.log(1<<3)
// Vue.createApp(App).mount("#app")
const { createApp } = Vue;
createApp(App).mount("#app");
typeof vm.selected // => 'object'
Enter fullscreen mode Exit fullscreen mode
加载指定的vue版本依赖:
<script src="https://unpkg.com/vue@3.0.2"></script>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)