Ant Design Vue - 使用某些组件直接报错 “组件未注册” did you register the component correctly?

前言 

[Vue warn]: Unknown custom element: <a-transfer> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

该款框架正常配置后,使用 <a-button> 等基础组件一切正常!

但今天使用<a-transfer> 穿梭框组件,突然控制台报错:

VM70088 vue.runtime.esm.js:620 [Vue warn]: Unknown custom element: <a-transfer> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

原因

框架为了减少编译支持库包大小,这些 “报错组件” 是 按需加入
说白话,就是这些报错组件需要你自己去手动加入,默认是不加载的。

 解决

一、依次打开项目文件夹 【src】 → 【core】,如下图所示:

二、找到【core】文件夹下的 lazy_use.js 文件,这是个按需加载的配置文件(每个项目的文件名不同),如下图所示:

三、加入 “未注册的组件”,如下图所示:

组件列表参照官网:https://github.com/vueComponent/ant-design-vue/blob/master/components/index.js

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章