Vue.js binding HTML class array syntax error reason analysis _javascript skill

Source: Internet
Author: User

Vue.js bound HTML class array syntax error, as shown in the details below:

Yesterday in the official website of the tutorial found a mistake is like this, look at the following picture

Http://cn.vuejs.org/guide/class-and-style.html

This is a bit cumbersome to write when you have more than one condition class. In 1.0.19+, object syntax can be used in array syntax:

If you write this, you can do it successfully, but there are errors

Data: {
ClassA: ' class-a ',
classb: ' Class-b ',
classc: ' class-c ', Isb:true
,
isc:false
}
<div:class= "[ClassA, {CLASSB:ISB, classc:isc}]" >

Render as:

<div class= "Class-a classb" >

If the class-b is not successful, the standard object syntax should be quoted here.

<div:class= "[ClassA, {' Class-b ': IsB, ' class-c ': IsC}]" >

Render as:

<div class= "Class-a class-b" >

The above is a small set to introduce the Vue.js bound HTML class array syntax error, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.