-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
$attrs not updating when change attrs via template v-if #1712
Comments
The root cause is because you are giving both branches of the This has to do with how But in your specific case:
|
@yyx990803 hello, could you explain please how i need to use v-if-else inside v-for? // eslint error: vue/require-v-for-key
<template v-for="item of items">
<div v-if="item"><div>
<span v-else></span>
</template>
// eslint error: vue/no-template-key
<template v-for="item of items" :key="item">
<div v-if="item"><div>
<span v-else></span>
</template>
// compile error: v-if branches must use compiler generated keys
<template v-for="item of items">
<div v-if="item" :key="item"><div>
<span v-else :key="item"></span>
</template> So the only option now is create wrap dom node(i.e. div) for this cases? Another case without "v-else" <template v-for="item of items">
<div v-if="item"><div>
<span></span>
</template> |
I'm using edit: Nevermind, on my case I had a 3rd |
Version
3.0.0-rc.4
Reproduction link
https://codepen.io/liquid-solid/pen/ZEQZLWp
Steps to reproduce
Custom input components renders via v-for and their state depends on which values in list,
true
orfalse
. There are different placeholders forfalse
andtrue
state. Click 'Add true to start' button to add true value to start ofitems
array and you can see that value in start of array istrue
, but placeholder still infalse
state.What is expected?
I expected for
my-input
component to update his placeholder to 'truthy' when value becomestrue
.What is actually happening?
Actually
my-input
component saves his 'falthy' placeholder when value becomestrue
.Expected behavior is needed for saving components state using only key. For example, true value may be added not on button click, but on input on falthy
my-input
, and i want to save focus on this element, but not remounting this component and all its internals, i want simply change his state. I am used to tricks like this in Vue 2.P. S. Sorry for my english )
The text was updated successfully, but these errors were encountered: