How to use switch selector in WeChat applet

亚连
Release: 2018-06-08 16:28:35
Original
2909 people have browsed it

This article mainly introduces the use of the switch selector of the WeChat applet in detail. It has certain reference value. Interested friends can refer to it.

This article shares with you the WeChat applet switch selector. How to use the program switch switch selector is for your reference. The specific content is as follows

Rendering

How to use switch selector in WeChat applet

##WXML

  状态:{{isChecked1}}    状态:{{isChecked2}}    状态:{{isChecked3}}    状态:{{isChecked4}}    状态:{{isChecked5}}    状态:{{isChecked6}}   
Copy after login

JS

var pageObj = { data: { isChecked1: false, isChecked2: true, isChecked3: false, isChecked4: true, isChecked5: false, isChecked6: true } }; for (var i = 0; i < 7; ++i) { (function (i) { pageObj['changeSwitch' + i] = function (e) { var changedData = {}; changedData['isChecked' + i] = !this.data['isChecked' + i]; this.setData(changedData); } })(i) } Page(pageObj);
Copy after login

Attributes of the switch component

  • checked: Whether to check—false, true

  • type: The style of the switch selector—- switch, checkbox

  • color: The color of switch, the same as the color of css

The above is what I compiled for everyone, I hope it will be helpful to everyone in the future helpful.

Related articles:

How to implement offset and uniform animation in JS

How to implement table merge cells in Bootstrap

How to get the first value in the select drop-down box in JavaScript

The above is the detailed content of How to use switch selector in WeChat applet. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!