這篇文章主要介紹了小程序之JavaScript動(dòng)態(tài)修改樣式的方法,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
test.wxml
<view style="text-align: center;"> <label style="color:pw_color;">我會(huì)變色</label> <button bindtap="clickRed">變紅</button> <button bindtap="clickgreen">變綠</button> </view>
test.js
Page({ data: { color: "red" }, clickRed: function () { this.setData({ color: "red" }) }, clickgreen: function () { this.setData({ color: "green" }) } })
效果
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“小程序之JavaScript動(dòng)態(tài)修改樣式的方法”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司,,關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來學(xué)習(xí)!