Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loop for component generation in the lowcode API #14

Open
PGimenez opened this issue Jul 15, 2023 · 0 comments
Open

loop for component generation in the lowcode API #14

PGimenez opened this issue Jul 15, 2023 · 0 comments
Assignees

Comments

@PGimenez
Copy link
Member

Explain how to iterate to generate multiple elements in a loop. MWE:

  module App
  using GenieFramework
  @genietools

  @app begin
    @out data = [
      ("msg1", "https://www.kasandbox.org/programming-images/avatars/spunky-sam.png"), 
      ("msg2", "https://www.kasandbox.org/programming-images/avatars/spunky-sam-green.png"), 
      ("msg3", "https://www.kasandbox.org/programming-images/avatars/purple-pi.png"),
    ]
  end
  
  function ui()
    row([card(style="margin: 10px;", @recur("item in data"), [
        p("{{ item[0] }}"),
        p("{{ item[1] }}"),
        imageview(src="{{item[1]}}")
    ]),])
    row([card(style="margin: 10px;", @recur("[msg, url] of data"), [
        p("{{ msg }}"),
        p("{{ url }}"),
        imageview(src=:url)
    ]),])
  end
  
  @page("/test", ui)
  end
@PGimenez PGimenez changed the title iteration in the lowcode API loop for component generation in the lowcode API Jul 15, 2023
@PGimenez PGimenez self-assigned this Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant