多语言展示
当前在线:1609今日阅读:61今日分享:18

vue添加class样式。

vue提供了一个动态添加class的v-bind:class(:class) 对象,可以使用:class进行clas动态的切换。案例中将通过使用:class设置 字体为红色。
方法/步骤
2

在html代码页面创建一个

同时添加id为app,并添加一段文本

3

引入vue.js文件。使用标签引入vue文件。

4

创建vue实例。新建一个

5

创建设置字体为红色的red样式。在标签后面创建一个<style>标签,然后设置字体为红色的red样式。代码:<style> .red{ color: red; } </style></p></div><div class="listcon"><span>6</span><p>使用:class添加red类样式。在<div>标签里面添加 :class='{red:true}'。</p></div><div class="listcon"><span>7</span><p>保存html代码后使用浏览器打开,即可看到字体已经变为了红色</p></div></div><div class="prev_next"> <div class="prev"> <span>上一篇:</span><a href="/dvegn.html">jquery判断是否有某个class</a> </div> <div class="next"> <span>下一篇:</span><a href="/dvegp.html">如何使用css类class选择符</a> </div> </div> </div> <div class="appleccmw content-right"> <div class="listmore">推荐信息</div> <div class="send_list"> <ul> <li><a href="/dvegi.html" title="vue怎么实现切换class类"><span>1</span><h3>vue怎么实现切换class类</h3></a></li> <li><a href="/dvego.html" title="vue添加class样式。"><span>2</span><h3>vue添加class样式。</h3></a></li> <li><a href="/ecrdc.html" title="word文档中审阅修订显示功能如何关闭"><span>3</span><h3>word文档中审阅修订显示功能如何关闭</h3></a></li> <li><a href="/ecrdb.html" title="word怎么取消退出修订模式"><span>4</span><h3>word怎么取消退出修订模式</h3></a></li> <li><a href="/ecrda.html" title="WORD文档如何查看所有的修订"><span>5</span><h3>WORD文档如何查看所有的修订</h3></a></li> <li><a href="/ecrcz.html" title="如何使用Word审阅修订中的自动更正功能呢?"><span>6</span><h3>如何使用Word审阅修订中的自动更正功能呢?</h3></a></li> <li><a href="/ecrcy.html" title="怎么限制用户在word中进行修订?"><span>7</span><h3>怎么限制用户在word中进行修订?</h3></a></li> <li><a href="/ecrcx.html" title="如何在CAD2018中输入特殊符号"><span>8</span><h3>如何在CAD2018中输入特殊符号</h3></a></li> <li><a href="/ecrcw.html" title="Word2013修订模式怎么取消"><span>9</span><h3>Word2013修订模式怎么取消</h3></a></li> <li><a href="/ecrcv.html" title="word怎么取消修订模式"><span>10</span><h3>word怎么取消修订模式</h3></a></li> <li><a href="/ecrcu.html" title="怎么将word修订模式恢复到显示正常"><span>11</span><h3>怎么将word修订模式恢复到显示正常</h3></a></li> <li><a href="/ecrct.html" title="CAD平方/立方符号怎么打"><span>12</span><h3>CAD平方/立方符号怎么打</h3></a></li> <li><a href="/ecrcs.html" title="Word2007怎么查看修订内容"><span>13</span><h3>Word2007怎么查看修订内容</h3></a></li> <li><a href="/ecrcr.html" title="CorelDraw中CorelKit绘图符号介绍"><span>14</span><h3>CorelDraw中CorelKit绘图符号介绍</h3></a></li> <li><a href="/ecrcq.html" title="如何使用office的突出修订的功能"><span>15</span><h3>如何使用office的突出修订的功能</h3></a></li> <li><a href="/ecrcp.html" title="Word如何删除修订内容"><span>16</span><h3>Word如何删除修订内容</h3></a></li> <li><a href="/ecrco.html" title="word怎么取消退出修订模式"><span>17</span><h3>word怎么取消退出修订模式</h3></a></li> <li><a href="/ecrcn.html" title="word2016怎样接受修订"><span>18</span><h3>word2016怎样接受修订</h3></a></li> <li><a href="/ecrcm.html" title="怎么在CAD中输入特殊符号"><span>19</span><h3>怎么在CAD中输入特殊符号</h3></a></li> <li><a href="/ecrcl.html" title="word2016怎么添加修订批注"><span>20</span><h3>word2016怎么添加修订批注</h3></a></li> <li><a href="/ecrck.html" title="CAD怎么快速简单绘制粗糙度图形符号"><span>21</span><h3>CAD怎么快速简单绘制粗糙度图形符号</h3></a></li> <li><a href="/ecrcj.html" title="Word修订标记怎么显示?"><span>22</span><h3>Word修订标记怎么显示?</h3></a></li> </ul> <div class="clear"></div> </div> </div> </div> <div class="clear"></div> <div class="onjfeeds"></div><span class="onj_live"></span><span class="childonj"></span><div class="onj_location"></div><span class="buddhaonj"></span><div class="branchesccmw footer_service"> <a href="/sitemap.html" target="_blank">网站地图</a> <a href="/sitemap.xml" target="_blank">XML</a> <a href="/sitemap.txt" target="_blank">TXT</a> <a href="/rss.xml" target="_blank">RSS</a> <a href="/privacy.html" target="_blank">隐私政策</a> <a href="/service.html" target="_blank">服务条款</a> <a href="/agreement.html" target="_blank">使用条款</a> <div class="flagccmw footer_copyright clogWalletccmw">Copyright ©1996-2024 www.onijiang.com Corporation, All Rights Reserved</div> </div> <script src="/static/index1js/jquery-3.5.1.min.js" rel="external nofollow"></script> <script src="/static/js/share.js" rel="external nofollow"></script> <script src="/static/js/tran.js" rel="external nofollow"></script> <script src="/static/js/langs.js" rel="external nofollow" ></script> <div class="onj_happy"></div><span class="containeronj"></span><div class="baronj" id="baronj"></div><div id="Family_seal_onj"></div><script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https'){ bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else{ bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body> </html>