How to implement JS dynamic Modification of style in Wechat Development
This article mainly introduces the development of Wechat how to achieve JS dynamic modification style, the article is very detailed, has a certain reference value, interested friends must read it!
WeChat Mini Programs this pit, ah, js dynamically modify the style, we can not use js or jq easily one line of code to solve. Or use removeClass addClass to modify the style.
The following is a way to dynamically modify the style, the principle is to bind the data, and then dynamically modify the data, so as to achieve the dynamic style change. It feels a little bit like that. It's weird. But there's nothing I can do about it. If you have a better way, you can share it in the comments section.
Test.wxml
I will change color and turn red to green.
Test.js
Page ({data: {color: "red"}, clickRed: function () {this.setData ({color: "red"})}, clickgreen: function () {this.setData ({color: "green"})})
Effect.
These are all the contents of this article entitled "how to implement JS dynamic Modification style in Wechat Development". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!