[Vuejs]-How to use a Vue instance as data

0👍

One way to iterate the trees in an example forest template:

    template: "#forest-template",
    compiled: function(){
        for (var i = 0; i < 10; i++)
        {
            this.forest.push({foo:i})
        }
    }

HTML:

<div id="forest-template">
    <template v-for="tree in forest">
        <tree v-bind:foo="tree.foo"></tree>
    </template>
</div>

Leave a comment