vue3.0的新特性有哪些


当前第2页 返回上一页

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事件

    1. inheritAttrs: false (class, style, events, css scope)

      设置不默认挂载到根节点,不过这会导致class等都不会挂载到根节点上

    2. 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的新特性有哪些的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

html5新特性之webrtc详解

vue3.0什么时候发布的

vue3.0的新特性有哪些

css3常见新特性介绍

详解css contain新特性如何控制页面重绘与重排

html5的新特性有哪些?html5新特性的总结

html5新特性之websocket

html5新特性有哪些

vue3.0和vue2.0的区别是什么?

更多相关阅读请进入《vue3.0》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...