Skip to content

[feature request] local variables in v-for #2575

@Centaur

Description

@Centaur

Here is a nested v-for case

<div v-for="x in xs">
      <div v-if="calcYs(x).length>0">
            <div v-for="y in calcYs(x)"> {{y}} </div>
      </div>
      <div v-else>fallback content</div>
</su-tab>

where calcYs is a method. As you can see, for every x, calcYs(x) will be called twice (if not empty) which is not necessary. It would be more efficient if we can bind the result of calcYs(x) to some local variables inside v-for.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions