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

v-show doesn't seem to work #156

Open
RohanTalip opened this issue Jun 7, 2019 · 5 comments
Open

v-show doesn't seem to work #156

RohanTalip opened this issue Jun 7, 2019 · 5 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@RohanTalip
Copy link
Contributor

This doesn't work as expected for me:

<template>
  <view>
    <text v-show="false">Hide this</text>
  </view>
</template>

i.e. The "Hide this" text still shows up.

Also, the code example for v-show in the Vue Native documentation actually uses v-if:
https://vue-native.io/docs/conditional.html#v-show

@RohanTalip
Copy link
Contributor Author

Also the documentation for v-show has this text: "v-show keeps the element on the View, and only adjusts the opacity to 0%, or transparent".

It might be better to toggle between display: 'flex' and display: 'none' in the style for a component, rather than changing the opacity of the view, i.e. similar to how v-show in Vue.js works.

@icarter09
Copy link

@RohanTalip confirmed that this is an issue. Looking into applying a fix like you suggested and also looking into the test cases for v-show.

@RishabhKarnad RishabhKarnad added the bug Something isn't working label May 6, 2020
@RishabhKarnad RishabhKarnad added the help wanted Extra attention is needed label Aug 24, 2020
@jbarba4
Copy link

jbarba4 commented May 30, 2021

For what it's worth, I ran into this problem when attempting to use v-show to control the output of a child component that did NOT have a single top-level element. Wrapping the child component elements in a div gave me the expected behavior with v-show.

@everttrollip
Copy link

everttrollip commented Oct 22, 2021

@jbarba4 I can confirm the same on my side, if I wrap this with a single top-level element, it works again as normal. Am I missing something in the docs, is there a new dependency update that causes this? Here is my code example which didn't work,

<some-custom-element v-show=someVariable></some-custom-element>

after wrapping it with a div it worked,

<div>
  <some-custom-element v-show=someVariable></some-custom-element>
</div>

Do I really require this for all elements where I use the v-show directive?

@OzzyTheGiant
Copy link

Can confirm v-show and v-if doesn't work on simple things like

or

, they have to be wrapped by a parent element, which sounds dumb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants