重磅|vue3.0终于来了
点击蓝字 「前端小苑」关注我
在10月5日凌晨,vue作者尤雨溪在微博上宣布Vue3.0的源码开放了。期待已久的Vue3.0终于如约与大家见面了。是不是有些小激动!?
(点击文末左下角 阅读原文,直接跳转到vue3.0源码!)
尤雨溪表示,Vue3.0目前依然是pre-alpha状态,但主要的架构改进、优化和新功能都已经完成,剩下的主要是完成一些Vue2现有功能的移植。
接下来我们看一下Vue3.0都已经完成了哪些架构改进和新功能。
Compiler
Modular architecture
"Block tree" optimization
More aggressive static tree hoisting
Source map support
Built-in identifier prefixing (aka "stripWith")
Built-in pretty-printing
Lean ~10kb brotli-compressed browser build after dropping source map and identifier prefixing
Runtime
Significantly faster
Simultaneous Composition API + Options API support, with typings
Proxy-based change detection
Fragments
Portals
Suspense w/ async setup()
未完成的Vue2现有功能的移植有:
Server-side rendering
<keep-alive>
<transition>
Compiler DOM-specific transforms
v-on DOM modifiers
v-model
v-text
v-pre
v-once
v-html
v-show
可见,Vue3.0
更小!
去除source map和identifier prefixing后的核心库代码将在10kb上下。
更快!
基于Proxy的数据监测,性能整体优于getter/setter
采用Block Tree,突破了传统vdom的性能瓶颈。
是不是等不及了?! 点击左下角阅读原文,将跳转到vue3.0源码。