标签:npm lang src html vue class line lse .class
<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <title></title> <script src="https://cdn.jsdelivr.net/npm/vue"></script> </head> <body> <div id="app"> <ul> <li v-for="item in tabs" :class="[classA, {classB: isB, classC: isC}]"> {{ item.text }} </li> </ul> </div> <script type="text/javascript"> new Vue({ el:‘#app‘, data: { classA: ‘A‘, isB: false, isC: true, tabs: [{ text:‘巴士‘ },{ text:‘快车‘ },{ text:‘专车‘ },{ text:‘顺风车‘ },{ text:‘出租车‘ },{ text:‘代驾‘ }] } }) </script> <style type="text/css"> .A{ color: red } .classC{ text-decoration: underline; } .classB{ font-weight: bold } </style> </body> </html>
标签:npm lang src html vue class line lse .class
原文地址:https://www.cnblogs.com/AmbiguousMiao/p/9025724.html