摘要: 像我这种react门徒被迫迁移到vue的,用管了TSX,地vue 单文件组件也不太感冒,但是vue3 单文件组件,造了蛮多api ,还不得去了解下 https://v3.cn.vuejs.org/api/sfc-script-setup.html#单文件组件-script-setup defineP 阅读全文
posted @ 2022-07-25 23:46 zhoulujun 阅读(699) 评论(0) 推荐(0) 编辑
摘要: provide inject 类似于消息的订阅和发布。provide 提供或发送数据, inject 接收数据。provide inject,两个只能在 setup 期间调用,添加响应性,使用 ref 或 reactive 。如果给变量加上 readonly 属性 阅读全文
posted @ 2022-07-25 23:42 zhoulujun 阅读(489) 评论(0) 推荐(0) 编辑
摘要: h 函数本质就是 createElement() ,h函数其实是createVNode的语法糖,返回的就是一个Js普通对象。在createVNode API 在创建Vnode的时候,会对Vnode的props、children、ref、class、style等属性进行规范梳理或者合并。 阅读全文
posted @ 2022-07-25 23:34 zhoulujun 阅读(3333) 评论(0) 推荐(0) 编辑
摘要: 如果你vue2的代码不是使用类组件(大部分应该都是vue-class-component vue-tsx-support ,官方停摆了,再次diss vue),而是使用@vue composition-api,那么用上Vue Demi 吧。 阅读全文
posted @ 2022-07-25 23:27 zhoulujun 阅读(1330) 评论(0) 推荐(1) 编辑
摘要: vue,还是选择vue-use好点。VueUse 是一个基于 Composition API 的实用函数集, 与 Composition API 的配合相得益彰。可以省下很多事。 阅读全文
posted @ 2022-07-25 23:18 zhoulujun 阅读(301) 评论(0) 推荐(0) 编辑
摘要: vue2带缓存的路由重构为 vue3 + tsx,keep-alive 不生效,而且警告 阅读全文
posted @ 2022-07-25 23:12 zhoulujun 阅读(696) 评论(0) 推荐(0) 编辑
摘要: vue2 x挂载全局是使用Vue prototype $xxxx=xxx的形式来挂载,在vue3 x这种方法显然是不行了,vue3中在setup里面我们都获取不到this,官方提供了globalProperties 阅读全文
posted @ 2022-07-25 23:07 zhoulujun 阅读(559) 评论(0) 推荐(0) 编辑
摘要: vue3 composition api 监听路由变化:onBeforeRouteUpdate、router.afterEach、 watch( () => route.params,()=>{}) 阅读全文
posted @ 2022-07-25 23:00 zhoulujun 阅读(677) 评论(0) 推荐(0) 编辑