element-plus中Failed to resolve component报错

vue3、element-plus项目中的报错信息:

Failed to resolve component: el-form If this is a native custom element, make sure to exclude it

Failed to resolve component: el-form If this is a native custom element, make sure to exclude it

Failed to resolve component el-form-item

Failed to resolve component Descriptions

Component inside <Transition> renders non-element root node that cannot be animated.

原因:

element的按需引入

解决方法:
1.在页面  script 中输入

import { ElForm } from "element-plus";

2.将常用的加入element-plus文件中

import {
    ElForm,
}

const components = [
    ElForm,
]

即可

你可能感兴趣的:(vue,vue,elementui)