element el-select Cannot read properties of null (reading ‘parentNode‘)错误

Uncaught (in promise) TypeError: Cannot read properties of null (reading ‘parentNode’)

runtime-core.esm-bundler.js:38 [Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core
在这里插入图片描述
需要定义一个ID_INJECTION_KEY给后续组件使用,引用element-plus修改如下

import { defineNuxtPlugin } from '#app'

import ElementPlus from 'element-plus'
import { ID_INJECTION_KEY } from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import zhCn from 'element-plus/es/locale/lang/zh-cn'

export default defineNuxtPlugin(nuxtApp => {
  if (process.client) {
    const app = nuxtApp.vueApp
    app
      .provide(ID_INJECTION_KEY, {
        prefix: Math.floor(Math.random() * 10000),
        current: 0
      })
      .use(ElementPlus, {
        size: 'small',
        locale: zhCn
      })

    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
      if (key === 'Link') {
        continue
      }
      app.component(key, component)
    }
  }
})```

根据提供的引用内容,报错信息"runtime-dom.esm-bundler.js:33 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'parentNode')"通常表示在Vue项目中使用过程中发生了一些错误。根据中的内容,这个错误通常发生在Vue的运行时核心文件中,可能是因为指令的使用错误或自定义指令的错误导致的。另外,提供了一个解决方法,建议检查拦截器中的判断条件,将code为200视为成功。 要解决这个错误,你可以按照以下步骤进行操作: 1. 首先,检查你的代码中是否存在具有错误拼写的指令,如v-text、v-html、v-model、v-if、v-show等。确保这些指令的拼写是正确的。 2. 如果你使用了axios调用第三方接口,在提供的解决方法中,建议检查控制台Network中的返回值,并确保接口请求已经正常发出并且有数据返回。 3. 如果你使用了axios拦截器,在提供的解决方法中,建议修改拦截器中的判断条件,将code为200也视为成功。这个修改可能需要根据实际接口返回值做相应的调整。 通过以上步骤,你应该能够解决这个错误并成功获取到接口返回值。如果问题仍然存在,请检查你的代码逻辑和其他相关配置。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [vue3 报错Cannot read property ‘deep‘ of undefined at withDirectives](https://blog.csdn.net/qq_39953537/article/details/119932800)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [前端Uncaught (in promise) 的解决方法及原因](https://blog.csdn.net/weixin_48986139/article/details/122671404)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值