Question 14
Consider the below Vue class binding.
Script.js:
var app = new Vue({ el: '#app', data : { classObj : { is_active: true, completed: false }, myClass: 'is_active', status: true }})Code 1:
<div :class="classObj"></div>Code 2:
<div :class="[status ? myClass : '']"></div>Which of the following statements is/are true, assuming both code 1 and code 2 are part of app object?
The code snippet 1 will render the div element with class “completed”, if the “completed” property of “classObj” is set to true.
The code snippet 2 will render the div element with class “completed”, if the data variable “status” is set to true.
Both the code snippets will render same HTML
Both the code snippets will render different HTML