简体   繁体   中英

Integrating React component in Neos CMS

Atm I'm playing around with Neos CMS and React.js a little bit. I was wondering if it is possible to get the content of a Neos NodeType as Json, so that i can use it as data for my React Components. I found some tutorials on special data for Neos but they all use a page as the basis. The problems I got now: If I use a content element, lets say an accordion, and put some data in there in Neos, I need a template for the container (so that React knows where to put stuff) but i dont want a template for the Accordion Items (These should go in the JSon File). So Question Number 1: How can I edit the content of an Accordion Item without haviing a template or telling the Accordion Container where to put the content of the children? And, Question number 2: How do I get the JSon-Object from the content (right now i use the TYPO3.TypoScript:Http.Message) and where do i find it (what is the url of this file)?

Here's is a detailed post on exactly this subject: http://dimaip.github.io/2015/11/15/react-neos/

To answer your questions directly:

How can I edit the content of an Accordion Item without haviing a template or telling the Accordion Container where to put the content of the children?

You can either create some dummy templates just for editing, or try to use raw content editing mode possible with some tuning to display all properties as inline fields. This situation will greatly improve with introduction of structured editing, but for now creating dummy templates shouldn't be too hard.

How do I get the JSon-Object from the content (right now i use the TYPO3.TypoScript:Http.Message) and where do i find it (what is the url of this file)?

You can take an example from this solution: https://github.com/sfi-ru/EncultDistr/blob/master/Packages/Sites/Sfi.Encult/Resources/Private/TypoScript/Json.ts2

In essence yes, use TYPO3.TypoScript:Http.Message with Json.stringify EEL helper to build up the JSON itself. The url would be the same as the url to your node, but only with .json format suffix instead of .html .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM