vue3使用elenent-plus

问题:

当我按照官网的下载并且引入element-plus之后发现会报错,步骤如下:

步骤一下载:

npm install element-plus --save

步骤二在main.js中引入并注册

import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'

const app = createApp(App)

app.use(ElementPlus)
app.mount('#app')

步骤三:在页面使用

<el-dialog
    v-model="dialogVisible"
    title="Tips"
    width="30%"
  >
    <span>This is a message</span>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="dialogVisible = false">Cancel</el-button>
        <el-button type="primary" @click="dialogVisible = false">
          Confirm
        </el-button>
      </span>
    </template>
  </el-dialog>

当我感觉能够顺利进行下去的时候,结果就是报错

[Vue warn]: resolveComponent can only be used in render() or setup(). runtime-core.esm-bundler.js:41 [Vue warn]: Unhandled error during execution of render function at <ElButton type="primary" > at <App> runtime-core.esm-bundler.js:41 Uncaught TypeError: currentRenderingInstance is null renderSlot runtime-core.esm-bundler.js:2819 default button2.mjs:83 normalizeChildren runtime-core.esm-bundler.js:7048 createBaseVNode runtime-core.esm-bundler.js:6859 _createVNode runtime-core.esm-bundler.js:6936 createVNodeWithArgsTransform runtime-core.esm-bundler.js:6813 createBlock runtime-core.esm-bundler.js:6785 setup button2.mjs:51 renderComponentRoot runtime-core.esm-bundler.js:820 componentUpdateFn runtime-core.esm-bundler.js:5748 run reactivity.esm-bundler.js:178 update runtime-core.esm-bundler.js:5861 setupRenderEffect runtime-core.esm-bundler.js:5869 mountComponent runtime-core.esm-bundler.js:5659 processComponent runtime-core.esm-bundler.js:5612 patch runtime-core.esm-bundler.js:5087 mountChildren runtime-core.esm-bundler.js:5331 mountElement runtime-core.esm-bundler.js:5238 processElement runtime-core.esm-bundler.js:5203 patch runtime-core.esm-bundler.js:5075 mountChildren runtime-core.esm-bundler.js:5331 mountElement runtime-core.esm-bundler.js:5238 processElement runtime-core.esm-bundler.js:5203 patch runtime-core.esm-bundler.js:5075 mountChildren runtime-core.esm-bundler.js:5331 mountElement runtime-core.esm-bundler.js:5238 processElement runtime-core.esm-bundler.js:5203 patch runtime-core.esm-bundler.js:5075 mountChildren runtime-core.esm-bundler.js:5331 mountElement runtime-core.esm-bundler.js:5238 processElement runtime-core.esm-bundler.js:5203 patch runtime-core.esm-bundler.js:5075 mountChildren runtime-core.esm-bundler.js:5331 processFragment runtime-core.esm-bundler.js:5546 patch runtime-core.esm-bundler.js:5061 componentUpdateFn runtime-core.esm-bundler.js:5755 run reactivity.esm-bundler.js:178 update runtime-core.esm-bundler.js:5861 setupRenderEffect runtime-core.esm-bundler.js:5869 mountComponent runtime-core.esm-bundler.js:5659 processComponent runtime-core.esm-bundler.js:5612 patch runtime-core.esm-bundler.js:5087 render runtime-core.esm-bundler.js:6379 mount runtime-core.esm-bundler.js:3832 mount runtime-dom.esm-bundler.js:1449 <anonymous> main.js:7 js app.js:41 __webpack_require__ app.js:212 __webpack_exports__ app.js:1334 O app.js:258 <anonymous> app.js:1335 <anonymous> app.js:1337 runtime-core.esm-bundler.js:2819

我一直苦苦寻找解决方案,怎么都不行,结果最后是删除依赖重新下载了。结果就可以了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值