您的位置:云创易联应用>学院>API接口>内容

状态栏管理

下面介绍调用方式:


第一步:引用


<script src="js/YCYLJS.js"></script>


第二步:调用

//获取状态栏高度(与沉侵式配合使用)

YCYL.api('statusBarHeight',(res)=>{

    //返回高度   

    console.log(res);  

})


//设置背景

YCYL.api('setBarBgColor',(res)=>{          

     console.log(res);

},'#e13737')



//设置样式(沉侵式/默认)

YCYL.api('setBarStyle',(res)=>{          

     console.log(res);

},true)


提示:

        1、网址封包(忽略第一步)直接调用。        

        2、在线封包时自动创建“YCYLJS.js”文件。        

        3、封包地址 https://www.ycylapp.com/pack/webpack/index.html


代码示例:


<!DOCTYPE html>

<html>

<head>

    <meta charset="utf-8">

    <title>演示</title>

    <script src="js/YCYLJS.js"></script>

    <script>        

         function run() {               

            //获取状态栏高度

            YCYL.api('statusBarHeight',(res)=>{

                //返回高度   

                console.log(res);  

            })

         }

    </script>

</head>

<body>

  <button onclick="run()>获取状态栏高度</button>

</body>

</html>


上一篇 下一篇