摘要: 关于Vue3里面的getCurrentInstance:可以获取挂载在全局的属性和获取上下文 这里会碰到几个问题: 一、不能使用getCurrentInstance的ctx 我们在获取Vue3中全局挂载的方法时会这么写: 这里的ctx不是setup提供的ctx const { ctx } = get 阅读全文
posted @ 2021-05-11 17:32 Mica 阅读(7158) 评论(2) 推荐(3) 编辑
摘要: 最近用vue3 重构vue2.x的项目,真是一坑未平,一波又起,话不多说 上代码 <template> <div>{{ loadingStatus }}</div> </template> ... setup(props, context) { // @ts-ignore const { proxy 阅读全文
posted @ 2021-05-11 15:47 Mica 阅读(2248) 评论(0) 推荐(0) 编辑
摘要: 子组件 child.vue <template> <div> <p>hello world</p> <button @click="handleClick">click</button> </div> </template> <script lang="ts"> import { defineCom 阅读全文
posted @ 2021-05-11 15:14 Mica 阅读(977) 评论(0) 推荐(0) 编辑