vue3报错 Cannot read properties of null (reading 'setupContext'),加入标签之后就报这个错误时为什么

vue3报错 Cannot read properties of null (reading 'setupContext'),加入标签之后就报这个错误时为什么

img

这个错误可能是因为在使用Vue3时,你在组件中使用了一个未定义或为 null 的变量或属性,而在 Vue3 中是不允许使用未定义或为 null 的变量或属性的,这可能是因为你没有在组件的 setup() 方法中正确初始化该变量或属性。或者是你在使用 ElementUI 的标签时,没有正确引入或配置 ElementUI,导致组件无法找到对应的标签。建议检查组件的 setup() 方法中是否正确初始化了所有变量或属性,检查是否正确引入和配置了 ElementUI。

看来图片后,这个错误是因为在template标签中使用了错误的标签名称。在这个例子中,使用了“kel-container”和“kel-aside”而不是“el-container”和“el-aside”。
请更正标签名称,应该改成

<el-container>
<el-header>Header</el-header>
<el-container>
<el-aside width="200px">Aside</el-aside>
<el-main>Main</el-main>
</el-container>

</div>
</template>