How to use slider to set data values in WeChat applet

亚连
Release: 2018-06-21 17:41:21
Original
4382 people have browsed it

This article mainly introduces the WeChat applet's use of slider to set data values and switch component functions. It analyzes the functions and usage of slider components and switch components in the form of examples. It also comes with source code for readers to download and refer to. Friends in need You can refer to the following

The example of this article describes the WeChat applet using slider to set data values and switch component functions. Share it with everyone for your reference, as follows:

Key code

① index.wxml

微信小程序组件:滑动选择器slider  最小值:{{min}} 最大值:{{max}} 当前值:{{text}} --------------------------------- 微信小程序组件:开关组件switch  开关组件当前状态:{{switchState}}
Copy after login

② index.js

Page({ data:{ // text:"这是一个页面" min:'20', max:'150', text:'', switchState:'开' }, sliderBindchange:function(e){ this.setData({ text:e.detail.value }) }, switchBindchange:function(e){ if(e.detail.value){ this.setData({ switchState:'开' }) }else{ this.setData({ switchState:'关' }) } } })
Copy after login

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

Related articles:

Use angular to write Message components

How to implement component communication in vue-cli

What should we pay attention to when optimizing Vue projects?

Developed in a modular way in vuejs

How to implement the array update function in VUE

How to use vue-cli to implement multi-page applications

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

Related labels:
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!