uniapp常用设置

1、系统信息

uni.getSystemInfo({
    success: function (res) {
        console.log(res.model);
        //状态栏高度
        console.log(res.statusBarHeight);
        console.log(res.windowWidth);
        console.log(res.windowHeight);
        console.log(res.language);
        console.log(res.version);
        console.log(res.platform);
    }
});

2、导航条设置

uni.setNavigationBarTitle({
    title: '新的标题'
});
//设置导航条颜色
uni.setNavigationBarColor({
    frontColor: '#ffffff',
    backgroundColor: '#ff0000',
    animation: {
        duration: 400,
        timingFunc: 'easeIn'
    }
})

3、自定义导航条

navigationStyle设为custom或titleNView设为false时,原生导航栏不显示

"globalStyle": {
		"navigationBarTextStyle": "black",
		"navigationBarTitleText": "Loading...",
		"navigationBarBackgroundColor": "#F8F8F8",
		"backgroundColor": "#F8F8F8",
		"navigationStyle":"custom"
	}

非H5端端状态栏高度

<view class="status_bar" style="background-color: #ffffff;">
                        <!-- 这里是状态栏 -->
</view>
.status_bar {
                height: var(--status-bar-height);
                width: 100%;
}

4、页面未加载完全时默认导航条文字

默认是应用名称name
在这里插入图片描述

5、文件

上传下载

uni.chooseImage({
  success: function (res) {
    var tempFilePaths = res.tempFilePaths;
    uni.saveFile({
      tempFilePath: tempFilePaths[0],
      success: function (res) {
        var savedFilePath = res.savedFilePath;
      }
    });
  }
});

6、节点布局信息

如果目标节点 “.test” 进入 “.scroll” 区域以下 100px 时,就会触发回调函数。


uni.createIntersectionObserver(this).relativeTo('.scroll',{bottom: 100}).observe('.test', (res) => {
  console.log(res);
})

7、复制内容到剪贴板

uni.setClipboardData({
				    data: '内容',
				    success: function () {
				        console.log('copy success');
						that.$u.toast('已复制')
			
				    }
				});

持续补充中。。。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值