template中不需要用一个p包裹即没必要只有一个根节点,可以多个标签(节点)并列
七、Custom Renderer API ( createRenderer )
NativeScript Vue integration underway by @rigor789
Users already experimenting w/ WebGL custom renderer that can be used alongside a normal Vue application(Vugel)
WEEX、Vue Native、小程序…
八、Tree Shaking
按需加载
除了保留一些必须的部分如:Virtual DOM更新算法、响应式系统,其他都是按需加载例如v-model等。
九、Suspense
Wait on nested async dependencies in a nested tree
Works with async setup()
Works with Aysnc Components
可以实现异步加载组件,整个DOM会事先在内存中进行虚拟的渲染,此时会等待异步的组件渲染,等所有的组件渲染完成之后,才会渲染到界面DOM上去。
十、Better TypeScript Support
Codebase written in TS w/ auto-generated type definitions
API is the same in JS and TS
- In fact, code will alse be largely the same
TSX support
Class component is still supported
十一、踩坑整理
事件
默认自动挂载根节点、废弃xxx.native事件
inheritAttrs: false (class, style, events, css scope)
设置不默认挂载到根节点,不过这会导致class等都不会挂载到根节点上
props
组件中设置一下事件属性声明。
新增emits配置
插槽
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-McvPeqpz-1606459132262)(C:\Users\20194\AppData\Roaming\Typora\typora-user-images\image-20201127104234202.png)]
watch
vue3.0中,可以通过配置flush:“sync“,来使得watch里面的函数和监听的元素值改变一起进行,不再在组件更新后执行。
v-model & .sync
JSX / TSX
1、@ant-design-vue / jsx
原来有的需要通过对象的方式来传属性值,现在新定义了属性,可以直接传
更多编程相关知识,请访问:编程视频!!
以上就是vue3.0的新特性有哪些的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
更多相关阅读请进入《vue3.0》频道 >>

Vue.js 设计与实现 基于Vue.js 3 深入解析Vue.js 设计细节
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者