Skip to content

empty slot does not render as default if there is v-if as evaluated false more than 1 #11856

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

Closed
KSH-code opened this issue Jan 7, 2021 · 9 comments

Comments

@KSH-code
Copy link

KSH-code commented Jan 7, 2021

Version

  • 2.6.11
  • 3.4.37

Reproduction link

play.vuejs.org

Steps to reproduce

click update button multiple times then value'll be set 0.

What is expected?

if value 0, then render "no data".

What is actually happening?

empty component as comment created.

@KSH-code
Copy link
Author

KSH-code commented Jan 7, 2021

I'm going to fix soon.

@posva
Copy link
Member

posva commented Jan 7, 2021

As a workaround, The proper code should use v-else-if

@posva posva added improvement and removed bug labels Jan 7, 2021
KSH-code pushed a commit to KSH-code/vue that referenced this issue Jan 7, 2021
@KSH-code
Copy link
Author

KSH-code commented Jan 7, 2021

Thank you for proposal!
By the way, people could mistake using v-if more than once instead of using v-else-if.

KSH-code pushed a commit to KSH-code/vue that referenced this issue Jan 7, 2021
KSH-code pushed a commit to KSH-code/vue that referenced this issue Jan 8, 2021
@KSH-code
Copy link
Author

@andacistan
No, I want to actually use slot using shorthand. :)
It does not need to name id

@KSH-code KSH-code reopened this Nov 24, 2021
@KSH-code KSH-code reopened this Nov 24, 2021
@KSH-code
Copy link
Author

@posva
I think this is kind of bugs, because normal programming languages support if statement like else if.
e.g.

if a == 1
  process for a
end
if b == 1
 process for b
end

is the same as

if a == 1; process for a
else if b === 1; process for b

Though I'm not a newbie in CS, but newbies can do with multiple if statement.

@mingtianshi
Copy link

Is there any optimization to this?
Because it seems to me the same

@KSH-code
Copy link
Author

KSH-code commented Dec 1, 2021

@mingtianshi It may be applied in 2.6.15, because of plan from #11857.

@KSH-code
Copy link
Author

I close this Issue, because it is not maintained

@KSH-code KSH-code reopened this Aug 13, 2024
@KSH-code
Copy link
Author

It is reproducible now.

@vuejs vuejs locked as too heated and limited conversation to collaborators Aug 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants