vue3.x已经正式发布了,部分小伙伴已经用了vue3.x开发,部分小伙伴还在观望中,下面是两个影响比较大的改动

1、beforeDestroy和destroyed不能用了。

这个应该是vue2.x项目升级为vue3.x项目影响最大的地方,突然发现项目中beforeDestroy和destroyed不会被调用了,可以批量替换为beforeUnmount和unmounted。

2、新增了 setup 函数。

执行 setup 时,组件实例尚未被创建。因此你在setup中不能使用this,同时你只能访问以下 property:props、attrs、slots、emit,将无法访问以下组件选项:data、computed、methods、refs。

setup函数有两个参数props和context。props 是响应式的,当传入新的 prop 的时侯,它将被更新。context可以用来访问上面可以使用的属性,相当于this。

最后,上两张硬核的图

最新文章

  1. 如何为Surface Dial设备开发自定义交互功能
  2. Yii源码阅读笔记(三十三)
  3. asp.net web api添加自定义认证
  4. SQL创建linkserver
  5. overflow:hidden清除浮动原理解析及清除浮动常用方法总结
  6. 软件工程 --- Pair Project: Elevator Scheduler [电梯调度算法的实现和测试]
  7. JVM virtual memory
  8. Struts学习之类型转换
  9. 横向、纵向时间轴timeline系列
  10. Jmeter_ForEach控制器实现网页爬虫
  11. shareSdk分享图片
  12. tile38 server 密码保护
  13. Java volatile 的测试(Java代码实战-004)
  14. The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. Make s
  15. ChinaTest测试感悟
  16. UI5-文档-4.4-XML Views
  17. Android查缺补漏(IPC篇)-- 进程间通讯之AIDL详解
  18. 在SQL Server 2008中执行透明数据加密
  19. IIS7.5 错误代码0x8007007e HTTP 错误 500.19
  20. CDN初学搭建(ats)

热门文章

  1. 各种插值法的python实现
  2. Appium问题解决方案(7)- Could not find 'adb.exe' in PATH. Please set the ANDROID_HOME environment variable with the Android SDK root directory path
  3. ABP VNext发布遇到的坑
  4. Redis核心原理与实践--列表实现原理之quicklist结构
  5. Docker Command and Dockerfile
  6. Java项目常用的统一返回跟统一异常处理
  7. Jmeter线程组设置
  8. 使用亚马逊服务器报错:Signature not yet current: 20190726T070253Z is still later than 20190726T070246Z (20190726T065746Z + 15 min.)时间不同步的解决办法
  9. 没想到 TCP 协议,还有这样的骚操作。。。
  10. 鸿蒙内核源码分析(字符设备篇) | 字节为单位读写的设备 | 百篇博客分析OpenHarmony源码 | v67.01