Analysis of the causes of syntax errors in binding HTML class arrays in Vue.js
Vue.js has a syntax error in binding HTML class array, the details are as follows:
I found an error like this on the official website tutorial yesterday, see the picture below
http://cn.vuejs.org/guide/class -and-style.html
This is a bit cumbersome to write when there are multiple conditional classes. In 1.0.19+, object syntax can be used in array syntax:
If written like this, it can be executed successfully, but there is an error
data: { classA: 'class-a', classB: 'class-b', classC: 'class-c', isB: true, isC: false } <div :class="[classA, { classB: isB, classC: isC }]">
is rendered as:
<div class="class-a classB">
If it is short Class-b such as horizontal characters is unsuccessful, so we still need to use standard object syntax with quotation marks
<div :class="[classA, { 'class-b': isB, 'class-c': isC }]">
Rendered as:
<div class="class-a class-b">

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
