跳到主要内容
ArcBlock Community

Pages Kit-Properties

Twelve
支持
pages-kitdocsresolved

Hey team, we’re building out an Marketplace component. The core idea is we’ve got a main React component that renders a series of cards. What we’d like to do is use the Add Property → Array feature in the Pages Kit panel to inject items into that component, instead of hardcoding every card.

So basically:

  • We have our main component code written.
  • We want the panel (where we can add JSON/array props) to feed directly into our component as items.
  • That way we can add new cards through the editor instead of editing code every time.

Can you point us to docs or an example of how this panel → props wiring is intended to work? Specifically: how to structure the schema so the editor values are passed correctly into the component?

Thanks!

2 条回复

xiaoliang11个月前

You can refer to the configuration in the image below. In the properties panel, add a list property and select the type as an Array. At this point, you will see the Add Sub Property button, which allows you to add properties for elements in the array. In my screenshot, I configured two properties: title and desc.

image.png

At this time, Pages Kit will automatically generate an editing interface for the array. In the component code, you can obtain the configuration data from props through list. The screenshot shows that the data structure received by the component is consistent with the Add Sub Property.

image.png

If you have any questions, please let us know.

Twelve11个月前

thank you. works great! my life just got so much easier! I assume it is a similar method for .json and the rest?

回复