Search code examples
vue.jsdirective

Does V-once also apply do child nodes of the applied element?


Does V-once also apply do child nodes of the applied element?

In the documentation they say foll

You can also perform one-time interpolations that do not update on data change by using the v-once directive, but keep in mind this will also affect any other bindings on the same node. -> source

What does it exactly mean to be on the same node?

  <div  id="one" v-once>
    This will never change {{ msg }}
    <span>But will it also never change in the child node?{{ msg }}</span>
  </div>
  <div id="two">
    It seems like div two is not on the same node.
  </div>

Solution

  • The answer is "yes, it applies to children".