Can I set for loop value in components render?
Use the questionCom you're passing to the model (use model to update model related logic) and I'd suggest using API from the Components documentation (eg. textType.view.extend is the old one)
Read full answer below βQuestion
Hi,I'm beginner in grapesjs. I want to make a question number by for loop when I dropped components, βI want final like this image. the div can show for loop number. βmy component's code In render, I divided the my default html questionCom from {{i}} into front and back. then,put them in render. {{i}} can perfect to show 1 2 3 in component. but ,the divided method is not good. HTML can't easy to read and I can't set complex html if I want likeβ Have any better method can solve my question? Thanks!
Answers (1)
Use the questionCom you're passing to the model (use model to update model related logic) and I'd suggest using API from the Components documentation (eg. textType.view.extend is the old one)
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3683
How to set the component cannot be deleted
Issue #2584
Set a button from Component settings active on click
So i made a custom countdown with a button The button set the countdown but i want to make the button active like other elements on click....
Issue #1723
[QUESTION] replacing particular text in dropped component
Hi, I get the value from custom traits from what I entered but I don't know how to change the particular value in dropped component and ren...
Issue #3414
Component model is not reset when create new drag
When dragging a component from right panel component model doesn't set to default value but has value of previously added component
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins βPremium plugins ship with support, regular updates, and production-ready features β save days of integration work.
Browse premium plugins βBrowse Plugin Categories
Jump directly to plugin category pages on the marketplace.