Add "keep-children" argument to v-if
See original GitHub issueWhat problem does this feature solve?
Imagine you have this component for wrapping an input:
<template>
<div class="container">
<input />
</div>
</template>
Like in this case I have several others where I would like to make only the container enclosing tag conditionally visible, but keeping the input, so it would be:
<template>
<input />
</template>
… depending on certain condition.
I know it’s possible to achieve this using the render function, but it’s too hard for me to maintain those (big in my case) components without really viewing the template as HTML itself.
What does the proposed API look like?
So, my suggestion is to add an argument to the v-if directive like “keep-children”. This way I could do something like:
<template>
<div v-if:keep-children="showContainer" class="container">
<input />
</div>
</template>
<script>
export default {
props: ['showContainer']
}
</script>
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Video of Joe Biden Wandering Around Toy Store Sparks Debate
The clip of Joe Biden appearing to walk aimlessly around carrying toys during an event has been viewed more than 880000 times.
Read more >Video: COUNTIFS and SUMIFS - Microsoft Support
Training: COUNTIFS applies criteria to cells across multiple ranges and counts the number of times all criteria are met. SUMIFS adds the cells...
Read more >VAST ad tag URL parameters - Google Ad Manager Help
A VAST ad tag URL is used by a player to retrieve video and audio ads. ... The child-directed parameter accepts a constant...
Read more >O'Shea Jackson Jr., Lily Allen & More Defend Children of ...
O'Shea Jackson Jr., Lily Allen - Video - 2022 ... Jackson Jr., Lily Allen & More Defend Children of Celebrities Amid Viral Debate...
Read more >Students fake an argument to surprise principal for her birthday
Gabrielle Flores, of California, went viral when she shared her family's Christmas plan on Tiktok, writing in a video that she told her ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can achieve it by creating really simple
functional
component https://jsfiddle.net/hpeocn97/Yes currently we can only use
render
function to implement a conditional wrapper with a lot of content.Instead of introducing a modifier for
v-if
, maybe I would rather use something like: