一、Vue2和3的区别
1、选项式api变成组合式api,但Vue3也支持选项式写法
2、性能提升了,体积更小,支持ts
3、响应式原理defineProperty变为proxy
4、增加了新组件(fragment、suspense、teleport)和api
5、路由、状态管理都变成了hook写法
6、移出filter
7、v-if优先v-for解析
8、可绑定多个v-model
二、新增了哪些函数api
ref、reactive、toRefs、watch、watchEffect、computed等
三、生命周期变化
beforeCreate、Created ->setup
beforeMount -> onBeforeMount
mounted -> onMounted
beforeUpdate -> onBeforeUpdate
updated -> onUpdated
beforeDestory(已废弃) -> onUnmount
destoryed(已废弃) -> onUnmounted
四、setup中如何让获取组件实例
通过getCurrentInstance
五、setup有哪些参数
1、props
2、context,解构出来有attrs、slots、emit
随手一写,欢迎指正、补充