question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

vue2.0.3 v-once doesn't work in list rendering?

See original GitHub issue

like this:

<template v-for="item in titems">
  <li>
    <div>{{item.message}}</div>
    <div><img :src='item.url' v-once></div>
  </li>
</template>

or this:

<template v-for="item in titems">
  <li>
    <div>{{item.message}}</div>
    <div v-once><img :src='item.url'></div>
  </li>
</template>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
seekerleecommented, Oct 25, 2016

@posva here’s my case just for reference:

We are working on en email app and emails are rendered by VueJS since 1.x version. emails in a conversation are stored in an array like below: data:{emails: [{ read:false, starred:false, content:'<div> html format data</div>' },{ read:false, starred:true, content:'<div> html format data2</div>' }]}

Since the email html content could be huge, we don’t want it be updated since born. And we need to do lots of DOM operation to the html content (I’m using a custom directive to do it when ‘inserted’). For example: add ellipsis and hide quoted content, highlight some text, add some link, process mentions by @ symbol etc. We also don’t want these operations to be executed more than once.

So we have the requirement for both v-once and v-for. In 1.x version we use {{{* email.content }}}, and it works good. After I spent some time updated VueJS to this version, I found this issue.

2reactions
posvacommented, Oct 17, 2016

@koronero I don’t understand your message, I wasn’t asking for a repro, I provided one 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

List Rendering - Vue.js
We can use the v-for directive to render a list of items based on an array. The v-for directive requires a special syntax...
Read more >
Vue2 + Vuex - not rendering array that is set successfully in store
The issue is not the size of the array, Vuex works amazing, ... I will try to create an autocomplete that would start...
Read more >
Rendering a list of Vue components - Learn web development
To learn how to loop through an array of data and render it in multiple components. Rendering lists with v-for. To be an...
Read more >
Rendering large datasets in Vue.js - LogRocket Blog
In this article we will talk about several ways to reduce rendering time and increase overall performance for large datasets in Vue, as...
Read more >
Common mistakes to avoid while working with Vue.js
count = 0; }, methods: { updateCount () { // JavaScript object is updated but // the component template is not rendered again...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found