2024-10-24 A plugin must either be a function or an object with an "install" function.

叶乘风 / 2024-11-13 / 原文

我在把一个组件注册到全局的时候遇到了这个警告,并且这个组件是没有生效的

原因:仅引用了组件的地址,最后使用app.user(组件),并没有给组件注册

解决方案:给组件注册,例如👇

import Item from "./index.vue";

Item.install = app => {
    app.component(Item.name, Item);
};

export default Item;

然后再use即可