问题一:
接口中获取出来的数据,在onLoad()中赋值给data中的属性,这时组件已经渲染完了,且数据使用的是data中默认的数据,当onLoad()复制完成后,界面不再重新渲染
解决:定义一个布尔类型的属性AAA,默认等于false,当在onLoad()中获取到接口的数据时,使其等于true,给最外层view加判断,如果AAA == true时再加载。
网上说使用his.$forceUpdate();但是我使用后发现没有效果,没弄明白为啥。
问题二:
获取地址路径中的参数
let curPage = getCurrentPages();
let params = curPage[curPage.length - 1].options; //获取当前页面参数,如果有则返回参数的对象,没有参数返回空对象{}
问题三:
APP分享图片到微信
async manyImgShare() {
var that =this
let list = that.shopPosters.shop_wxmnpg_code;
let urls = {};
urls.type = 'image'
urls.pictures = [],
urls.extra = {
scene: "WXSceneSession"
}
let [, imgPath] = await uni.downloadFile({
url: list
})
// 讲本地路径的url 添加到要pictures参数中
urls.pictures.push(imgPath.tempFilePath)
console.log(urls)
// 讲urls传入 调用系统分享 拉起微信 分享给好友
plus.share.sendWithSystem(urls, function() {
console.log('分享成功');
}, function(e) {
console.log('分享失败:' + JSON.stringify(e));
})
}