Skip to content

[feature] need v-initwhich is similar to anuglar's ng-init #2025

@yangjunjun

Description

@yangjunjun

Sometimes I want set a new property in 'v-for' loop for each item, but I find it hard.

<div v-for="item in items">
<!-- set a new property for each item -->
</div>

in Angular, by use ng-init, I can easily do it as below:

<div v-for="item in items">
  <p ng-init="item.show=false" >lorem </p>
</div>

so I wish vue will have a v-initwhich is similar to anuglar's ng-init.

scenario:

  1. vue: http://jsbin.com/deyotu/edit?html,js,output
  2. angular: http://jsbin.com/finayi/edit?html,js,output

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