Vue: [Suggestion for Performance] `.once` directive argument for v-for, :class etc

Created on 22 Mar 2016  Â·  6Comments  Â·  Source: vuejs/vue

It would be great if all Vue directives would support .once: v-for.once, :class.once, v-if.once for situations where you know the binded data won't change. I imagine this will increase performance.

feature request intend to implement

Most helpful comment

@blake-newman if you supply only bind without update then it is "once" already :)

All 6 comments

Sounds like a good idea.

Idea is nice! Additionally would it be good to allow this API level of the directive, for custom directives that may only ever need a single bind.

{
  once: true,
}

@blake-newman if you supply only bind without update then it is "once" already :)

@yyx990803 Very true.. doh! We have now implemented this into 2.0, and the plan is to keep this functionality to 2.0 only.

Closing: @vuejs/collaborators reopen if there is a change of plan.

This proposal has been accepted yet?

Not in Vue 1. In Vue 2 you have v-once

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lmnsg picture lmnsg  Â·  3Comments

bdedardel picture bdedardel  Â·  3Comments

aviggngyv picture aviggngyv  Â·  3Comments

paulpflug picture paulpflug  Â·  3Comments

robertleeplummerjr picture robertleeplummerjr  Â·  3Comments