Skip to content

suggest : v-show #77

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
blackss2 opened this issue Nov 4, 2017 · 5 comments
Closed

suggest : v-show #77

blackss2 opened this issue Nov 4, 2017 · 5 comments

Comments

@blackss2
Copy link

blackss2 commented Nov 4, 2017

As I know, v-if is not working properly.
So I made this custom v-show with simple directive.
only problem it has is sub components' conditions are evaluated.

Vue.directive('show', {
	inserted: function (el, attr) {
		el.setAttribute("visibility", attr.value ? "visible" : "collapsed");
	},
	update: function (el, attr) {
		el.setAttribute("visibility", attr.value ? "visible" : "collapsed");
	}
});
@rigor789
Copy link
Member

I've added the v-show directive, could you elaborate what you mean by

only problem it has is sub components' conditions are evaluated.

@blackss2
Copy link
Author

difference of v-if and v-show is [condtion statement on sub node is pre estimated or not].
v-if not estimate sub nodes if condition is false,
but v-show estimate all sub nodes always.
currently nativescript-vue's if not working properly, we should use v-show.
but if you use v-show, you should know sub node should have robust to own condition(obj.is_on -> obj && obj.is_on)

@rigor789
Copy link
Member

That is the expected behavior of v-show, it only hides thing visually. As for v-if not working, can you show me an example? I know it had issues in an action-bar but i think that's an edge case.

@blackss2
Copy link
Author

i misunderstand v-if is not working all part, cuz i use v-if only action bar.

@rigor789
Copy link
Member

For the action-bar, you might solve it like I did: #76 (comment)

Not the most ideal, but works

@rigor789 rigor789 added done and removed in progress labels Nov 19, 2017
@nativescript-vue nativescript-vue locked as resolved and limited conversation to collaborators May 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants