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

In version 0.4.3, :if instruction failure and inconsistent display performance. #227

Closed
hsuna opened this issue Mar 2, 2024 · 3 comments
Labels
question Further information is requested

Comments

@hsuna
Copy link

hsuna commented Mar 2, 2024

version:0.4.3

create app.nue:

<main @name="app">
  <ul>
    <li :for="item in items">
      <p :if="{item.value}">{ item.index }: <span>{item.value}</span></p>
    </li>
  </ul>

  <script>
    items = [
      { index: 1, value: true },
      { index: 2, value: false },
      { index: 3, value: 0 },
      { index: 4, value: 1 },
      { index: 5, value: '0' },
      { index: 6, value: '1' },
    ];
  </script>
</main>

run

nue

result:

image
  • :if instruction failure
  • false no display.

desire:

image
@nobkd
Copy link
Collaborator

nobkd commented Mar 5, 2024

Sorry for the late reply.

You just have to remove the curly braces ({}) from the :if condition to not render the ps when the value is falsy:

- <p :if="{item.value}">{ item.index }: <span>{item.value}</span></p>
+ <p :if="item.value">{ item.index }: <span>{item.value}</span></p>

Important

But it is true, that the false should be displayed as text, when there is no :if.

Could be related to #193 with a3b29f5


Can you tell, what you mean with inconsistent display performance in your title?

@nobkd nobkd added the bug label Mar 5, 2024
@hsuna
Copy link
Author

hsuna commented Mar 6, 2024

Sorry for the late reply.

You just have to remove the curly braces () from the condition to not render the s when the is :{}``:if``p``value``falsy

- <p :if="{item.value}">{ item.index }: <span>{item.value}</span></p>
+ <p :if="item.value">{ item.index }: <span>{item.value}</span></p>

Important

But it is true, that the should be displayed as text, when there is no .false``:if

Could be related to #193 with a3b29f5

Can you tell, what you mean with in your title?inconsistent display performance

Translation software issue, please ignore it

@nobkd nobkd mentioned this issue Mar 31, 2024
@nobkd nobkd added question Further information is requested and removed bug labels Apr 4, 2024
@nobkd
Copy link
Collaborator

nobkd commented Apr 4, 2024

Closing in favor of #248

@nobkd nobkd closed this as completed Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants