uniapp笔记

1、图片动态赋值
                     :style="{backgroundImage:'url('+item.cuIcon+')'}"
2、获取手机高度并赋值
mounted: function (res) {
var that = this;
uni.getSystemInfo({
    success: function (res) {
that.windowHeight = res.windowHeight;
    }
});
},
3、公众号往期文章
https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzU3NjQ3Mzg2Ng==&scene=124#wechat_redirect

4、URL编码解码
编码:encodeURIComponent('http://www.baidu.com?name=zhang@xiao@jie&order=1')
   结果:"http%3A%2F%2Fwww.baidu.com%3Fname%3Dzhang%40xiao%40jie%26order%3D1"
 
解码:decodeURIComponent("http%3A%2F%2Fwww.baidu.com%3Fname%3Dzhang%40xiao%40jie%26order%3D1")
 
   "http://www.baidu.com?name=zhang@xiao@jie&order=1"
加载中... 加载结束

 methods: {
fangfa()
{
var that = this;
uni.showLoading({title: '加载中',mask:true});
uni.request
({ url:'',
data: {},
method: 'POST',
header: '', dataType: 'json',
success: function (res)
{
//关闭加载中
setTimeout(function () {uni.hideLoading();}, 100);
}
})
},
}
uniapp上拉下拉监听事件
 	onPullDownRefresh() {
			console.log('下拉刷新');
			this.refreshing = true;
			if(this.tempPageSize > 1)
			this.tempPageSize -=1;
			this.getData();
		},
		onReachBottom() {
			console.log('上拉加载');
			this.refreshing = true;
			if((this.lists.length/10) < this.tempPageSize)
			this.tempPageSize +=1;
			this.getData();
		},
uniapp-tab监听事件
 onTabItemTap(item) {
		
		uni.showModal({
			title: item.text,
			showCancel: false
		})
		},
uniapp存储值
                uni.setStorageSync('openid',res.data)
               
                uni.getStorage({
key: 'openid',
success(e) {
_self.openid = e.data; //这就是你想要取的token
_self.searchChild(_self.ReceiveCallback);
},
fail(e) {
//openid = "error";
}
});
  uni.removeStorage({
            key:'url',
            success:function() {
                console.log(' 移除成功')      -----获取成功后移除key 中的内容
                }
        })
uni.clearStorage() 与 uni.clearStorageSync()   这两个都是清理本地数据的缓存   

V:   jbossjf

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值