类型与类型 'ColumnType<any>' 没有共同的属性
Type has no properties in common with type 'ColumnType<any>'
我正在用 React 和 ant design 写一个应用程序
我想用antd table
但它不显示我的数据
代码
const ListOfProperties = () => {
const columns = [
{
type: "Type",
state: "State",
location: "Location",
},
];
const properties = [
{
type: "Flat",
state: "Anambra",
location: "Udoka",
},
{
type: "Flat",
state: "Anambra",
location: "Udoka",
},
];
return (
<Skeleton active loading={loading}>
<Table columns={columns} dataSource={properties} />
</Skeleton>
);
};
export default ListOfProperties;
我创建了一个对象数组,将其传递给数据源,并将列传递给列
如文档中所述
但我收到错误
错误
Type '{ type: string; state: string; location: string; }' has no properties in common with type 'ColumnType<any>'
.
您需要提供title
、dataIndex
和key
。始终先在 documentation 中查找。
const columns = [
{
title: "Type",
dataIndex: "type",
key: "type"
},
{
title: "State",
dataIndex: "state",
key: "state"
},
{
title: "Location",
dataIndex: "location",
key: "location"
},
];
我正在用 React 和 ant design 写一个应用程序
我想用antd table
但它不显示我的数据
代码
const ListOfProperties = () => {
const columns = [
{
type: "Type",
state: "State",
location: "Location",
},
];
const properties = [
{
type: "Flat",
state: "Anambra",
location: "Udoka",
},
{
type: "Flat",
state: "Anambra",
location: "Udoka",
},
];
return (
<Skeleton active loading={loading}>
<Table columns={columns} dataSource={properties} />
</Skeleton>
);
};
export default ListOfProperties;
我创建了一个对象数组,将其传递给数据源,并将列传递给列
如文档中所述
但我收到错误
错误
Type '{ type: string; state: string; location: string; }' has no properties in common with type 'ColumnType<any>'
.
您需要提供title
、dataIndex
和key
。始终先在 documentation 中查找。
const columns = [
{
title: "Type",
dataIndex: "type",
key: "type"
},
{
title: "State",
dataIndex: "state",
key: "state"
},
{
title: "Location",
dataIndex: "location",
key: "location"
},
];