• mui的switch开关的应用


    HTML:   
    <!--mui的switch开关-->
                <div class="mui-content-padded">
                    <h5>switch开关mui-active开启状态</h5>
                    <div class="mui-switch mui-active">
                        <div class="mui-switch-handle"></div>
                    </div>
                </div>
                
                 <div class="mui-content-padded">
                    <h5>mui-switch-blue:设置颜色</h5>
                    <div class="mui-switch mui-switch-blue">
                        <div class="mui-switch-handle"></div>
                    </div>
                </div>
                
                <div class="mui-content-padded">
                    <h5>mui-switch-mini:无文字提示开关</h5>
                    <div class="mui-switch mui-switch-blue mui-switch-mini">
                        <div class="mui-switch-handle"></div>
                    </div>
                </div>
                
                 <div class="mui-content-padded">
                    <h5>男女性别开关</h5>
                    <div class="mui-switch mui-switch-blue" id="gender">
                        <div class="mui-switch-handle"></div>
                        
                    </div>
                    
                    <div class="mui-content-padded">
                        <p class="mui-text-center" id="msg">这里是文字提示</p>
                    </div>
                </div>
                <!--点击按钮获取信息-->
                <div class="mui-content-padded">
                    <button id="btn-get-gender" class="mui-btn mui-btn-blue">获取性别</button>
                </div>
    
    JS:
    监听事件函数:
    document.getElementById('btn-get-gender').addEventListener('tap',function(){
                //classList.contains('mui-active'):判断类名是否包含active,如果包含表示处于打开状态(ture)
                    var gender=document.getElementById('gender').classList.contains('mui-active')
                    console.log(gender)//ture/false
                    
                    if(gender==true){
                        document.getElementById("msg").innerHTML='女'
                    }else{
                        document.getElementById("msg").innerHTML='男'
                    }
                })
     
     
     
     
     
  • 相关阅读:
    Binder之启动ServiceManager
    CameraMetaData
    Android JNI 使用的数据结构JNINativeMethod详解
    CameraCaptureSession
    深入理解Android相机体系结构之3---相机服务层
    Camera Service
    Camera相关代码路径
    Android打开ALOGV日志
    深度学习高分辨率遥感影像语义分割
    全自动Landsat影像温度反演软件开发
  • 原文地址:https://www.cnblogs.com/Dark-fire-liehuo/p/10417859.html
Copyright © 2020-2023  润新知