Considerations for V-bind Binding class in Vuejs

Source: Internet
Author: User

About instances of V-bind binding class

Function: can be used to switch between different styles

1<! DOCTYPE html>234<meta charset= "UTF-8" >5<title>Document</title>6<script src= "Https://unpkg.com/vue" ></script>7<style>8 . static {9font-size:120px; Ten width:600px;  Onemargin:0Auto;  Abackground-Color:yellow;  - height:120px;  -line-height:120px;  thetext-Align:center;  -   }   -    -. class-a { + color: #FF0000;  -   }   +    A. class-B { attext-Decoration:underline;  -   }   -</style> - -    -<body> in<div id= "App" > -<div v-bind:class= "Classobject" > to about the binding of class +</div> -</div> the<script> *   varVM =NewVue ({ $El: ' #app ',  Panax Notoginseng data: { - Classobject: { the         //' class-a ', cannot be written as class-a (without quotation marks); Here the Classobject is a JS object, and Class-b is a style, so it must be written ' class-a ', enclosed in quotation marks.  +         //otherwise the class-a can only represent a property name of Classobject, so Vuejs will error when initializing.  A' Class-a ':true,   the' Class-b ':false   +       }   -     }   $   });  $</script> -</body> -    the

Considerations for V-bind Binding class in Vuejs

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.