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