How does WeChat Mini Programs realize the effect of selecting specifications and colors for shopping carts?
This article mainly explains "how to achieve the color effect of shopping cart selection specifications by WeChat Mini Programs". The explanation in the article is simple and clear, easy to learn and understand. Please follow the editor's ideas slowly and deeply. Let's study and learn how WeChat Mini Programs can achieve the color effect of shopping cart selection specifications.
The details are as follows:
Wxml:
Specification: {{item.name}} Color: {{item.name}} {{guige [gindex] .name}}: {{color [cindex] .name}}
Js:
/ / pages/guige/guige.jsPage (initial data of {/ * page * / data: {guige: [{id:1,name:'M'}, {id:2,name:'L'}, {id:3,name:'X'}, {id:4,name:'S'}], color: [{id:5,name:' Red'}, {id: 6 Name: 'orange'}, {id: 7, name: 'yellow'}, {id: 8, name: 'green'}]}, guige:function (e) {this.setData ({gid: e.currentTarget.dataset.index, gindex: e.currentTarget.dataset.current,})}, color:function (e) {this.setData ({cid: e.currentTarget.dataset.index) Cindex: e.currentTarget.dataset.current,})}, / * Lifecycle function-load the listening page * / onLoad: function (options) {}, / * Lifecycle function-completed the first rendering of the listening page * / onReady: function () {} / * Lifecycle function-listener page display * / onShow: function () {}, / * Lifecycle function-listener Page Hidden * / onHide: function () {}, / * Lifecycle function-listener Page Unload * / onUnload: function () {} / * Page-related event handler function-listens for user drop-down action * / onPullDownRefresh: function () {}, / * page event handler * / onReachBottom: function () {}, / * user clicks on the upper right corner to share * / onShareAppMessage: function () {}})
Css:
.color {color: red} .dis {display: flex;justify-content: space-around} thank you for reading, the above is "how to achieve the shopping cart selection specification color effect" content, after the study of this article, I believe that WeChat Mini Programs how to achieve shopping cart selection specification color effect of this problem has a deeper understanding, the specific use also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!