VUE3学习笔记

518 阅读1分钟

1. const { appContext } = getCurrentInstance();

报错:Property 'appContext' does not exist on type 'ComponentInternalInstance | null'.ts(2339)

解决方案:使用ComponentInternalInstance进行断言;
const { appContext } = getCurrentInstance() as ComponentInternalInstance;

2.