我正在撰寫一個帶有反應和螞蟻設計的應用程式
我想用antd表
但它沒有顯示我的資料
代碼
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>'.
uj5u.com熱心網友回復:
您需要提供title,dataIndex和key. 總是先在檔案中查找它。
const columns = [
{
title: "Type",
dataIndex: "type",
key: "type"
},
{
title: "State",
dataIndex: "state",
key: "state"
},
{
title: "Location",
dataIndex: "location",
key: "location"
},
];
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/403090.html
標籤:
上一篇:使用鍵從陣列中洗掉重復物件
