[Vuejs]-Anyone can tell me what lenguaje are use in this line of code?

3๐Ÿ‘

โœ…

<div :class="[task.reminder ? 'reminder' : '', 'task']">

source: https://v2.vuejs.org/v2/guide/class-and-style.html#Array-Syntax

this line will conditionally add array of class that will be joined by a space . So on the first element of the array, it is a ternary operator which depend on task.reminder value, if it is true or something meet the requirement of the ternary, it will add reminder class or an empty string '' which will not be added to the class, and on the index 1 of the array which is task will be added.

Say for example that your task.reminder is true, the div will be render as below:

<div class="reminder task">

if it is false, it will be render as

<div class="task">

{{ task.text }}

source: https://v2.vuejs.org/v2/guide/syntax.html?redirect=true#Text

this is how we render out a variable from vue into the DOM, wrap with {{ and }}

๐Ÿ‘คDavid Yappeter

Leave a comment