Moving on with the Vue Crash Course

So one great thing that comes from doing things yourself instead of just following tutorials is learning more than you would otherwise.

In my experiments, I resolved conditional display of my todos via the v-if directive:

<template>
    <div class="todo-item is-complete" v-if="todo.completed">{{todo.text}}</div>
    <div class="todo-item" v-else>{{todo.text}}</div>
</template>  

In the tutorial, the dude went on and used a simpler v-bind directive:

<template>
    <div class="todo-item" v-bind:class="{'is-complete':todo.completed}"> {{todo.text}} </div>
</template>

I’ve also learned that to communicate something from a lower level component to an upper level component, I need to emit an event. I also learned emit has only one m, who knew. I learned to insert methods, pass on events… a whole buncha things.

Leave a Reply

Your email address will not be published. Required fields are marked *