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> - theConsiderations for V-bind Binding class in Vuejs