vue3使用 getCurrentInstance 遇到的疑惑

vue3使用 getCurrentInstance 遇到的疑惑,请问有谁可以解释一下下面两种不同写法的区别吗?

第一种:
const a1= getCurrentInstance()?.proxy;
a1?.$toast({type: 'error', text: '登录失败' });
第二种:
const a2= getCurrentInstance();
a2.proxy.$toast({type: 'error', text: '登录失败' });

两种方式没啥区别的,a1是直接获取到了getCurrentInstance函数返回的proxy对象,a2是获取getCurrentInstance函数返回的对象,也就是a1与a2.proxy一样,都表示getCurrentInstance函数返回的proxy对象,不过需要注意的是a1的表达式中使用了可选连"?",如果getCurrentInstance函数返回的对象中并没有proxy属性,则a1为undefined