I think it is logically wrong when I use v-once with v-for #14045
wsu-sie-ung
started this conversation in
General Discussions
Replies: 2 comments 1 reply
-
|
Use v-once on the parent element <div v-for="(luckyNumber, index) in myLuckyToto4DNumbers" v-once >
<span>{{index+1}}: {{luckyNumber}}</span>
</div>On the initial loop, it's also updating that element, changing its inner text content |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
When using v-once on a v-for container, should we write "key" |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
below is the rendered result:

At first, I thought it would loop through the array and display each number accordingly. Since it uses v-once, I expected that any future updates would not be reflected on the screen. However, after running it, it displayed the first number five times. What I expected was for it to initially render 5707, 1171, 2150, and 1771, and then ignore any subsequent changes to the array values.
Beta Was this translation helpful? Give feedback.
All reactions