我尝试在 AdminBro 中为照片构建自定义组件: 在选项中:
const options = {
properties: {
photo: {
components: {
edit: AdminBro.bundle("../../src/photo"),//the path is right !
},
},
},
};
照片编辑组件:
import React from "react";
const Edit = () => {
return <div>hello</div>;
};
export default Edit;
和admin bro的创建条目:
AdminBro.UserComponents = {}
import Component1 from '../controllers/resources/photo'
AdminBro.UserComponents.Component1 = Component1
我不知道为什么我得到:
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check the render method of `BasePropertyComponent`.
有关更多详细信息,请参阅开发控制台...
.
react_devtools_backend.js:2430 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
检查BasePropertyComponent
的渲染方法........