uni-app 各种常用设置

uni-app 修改原生导航自定义按钮样式

setTitleNViewButtonStyle:function(){
  this.btnStatus = !this.btnStatus;
	// #ifdef APP-PLUS
	var webView = this.$mp.page.$getAppWebview();
	webView.setTitleNViewButtonStyle(0, {  
		text: this.btnStatus ?'编辑':'完成', 
		color:this.btnStatus ?'#479dfd':'#ce2a21'
	}); 
	// #endif		
},

uni-app ios禁止侧滑(滑屏)返回

"app-plus": {
	"popGesture": "none",// 禁止ios侧滑返回
	"bounce": "none",
	"titleNView": {
	"autoBackButton":"false",
	"backgroundColor": "#fff",
	"buttons": [{
		"text": "帮助",
		"fontSize": "16"
	  }
	]
  }
}

uni-app 传递对像到子页面

let detail = {
	author_name: e.author_name,
	cover: e.cover,
	id: e.id,
	ost_id: e.post_id,
	published_at: e.published_at,
	title: e.title
	};
uni.navigateTo({
url: '../../pageName?detailDate=' + encodeURIComponent(JSON.stringify(detail))
);

uni-app vue3+vite+ts 图片转base64

const setImage = (e : any) => {
		uni.compressImage({
			src: e.path,
			quality: 10, 
			success: res => {
				plus.io.resolveLocalFileSystemURL(res.tempFilePath, function (entry) {
					entry.file(function (file) { 
						var fileReader = new plus.io.FileReader()
						fileReader.readAsDataURL(file)
						fileReader.onload = function (evt) {
							let image_base64 = evt.target.result,e.id ;
						}
					})
				})
			}
		})
	}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值