安卓无故卡死,iOS版本没问题,整个页面是白色的,体验版输出也调不出来,求解决,急等
网友回复:
你好,请提供一下出现问题的机型和微信版本,以及能复现问题的简单代码示例。
机型:红米手机 Redmi 4A
Android版本:6.0.1 MMB29M
微信版本:6.5.13
代码示例:
const util = require( "../../utils/util.js" ); var app = getApp(); var that; Page({ data: { // 位置信息 location: { latitude: "" , longitude: "" , name: "重新定位" }, scrollTop: 0 , // 左侧菜单列表 leftClassesMenuList: [], // 左侧菜单选中item selectedLeftMenuItem: {}, // 商品列表 selectedProductList: [] }, onShareAppMessage: function (res) { if (res.from === 'button' ) { // 来自页面内转发按钮 console.log(res.target) } return { title: '甜街' , path: '/pages/index/index' , success: function (res) { // 转发成功 }, fail: function (res) { // 转发失败 } } }, onLoad: function () { this .$wuxToast = app.wux( this ).$wuxToast; that = this ; this .getLeftMenuData(); }, // 左侧菜单栏切换事件 selectClassesClick: function (e) { var index = e.currentTarget.dataset.index; var selectedValue = that.data.leftClassesMenuList[index]; that.setData({ selectedLeftMenuItem: selectedValue, scrollTop: 0 }); // 获取蛋糕列表 that.getCategoryItemsConnection(); }, // 进入商品详情页面 detailCakeAction: function (e) { var index = e.currentTarget.dataset.index; var item = this .data.selectedProductList[index]; app.globalData.cakeSpuItem = null ; app.globalData.cakeSelectedSize = null ; app.globalData.addressList = null ; app.globalData.fpInfo = null ; app.globalData.nsrInfo = null ; app.globalData.remarkStr = null ; app.globalData.time = null ; app.globalData.date = null ; wx.navigateTo({ url: '/pages/detail/detail?id=' + item.spu.id + '&title=' + item.spu.name, }) }, // 进入代金券详情页面 couponDetailAction: function (e) { wx.navigateTo({ url: '/pages/coupon/list/coupon?showPopview=show' , }) }, // 返回顶部 goTop: function (e) { this .setData({ scrollTop: 0 }) }, // 获取定位 getLocationPlace: function () { wx.chooseLocation({ success: function (res) { that.setData({ location: { latitude: res.latitude, longitude: res.longitude, name: res.name } }) }, fail: function (res) { console.log( "fail" ); that.setData({ location: { latitude: that.data.location.latitude, longitude: that.data.location.longitude, name: "重新定位" } }) }, complete: function (res) { console.log( "complete" ); }, }) }, //刷新列表数据 getLeftMenuData: function () { //加载提示框 util.showLoading(); var urlStr = '/miniprogram/category/list' ; var parameters = "" ; util.request(urlStr, parameters, function (res) { var code = res.statusCode; if (code == 200 ) { var dataArray = res.data; util.hideToast(); that.setData({ leftClassesMenuList: dataArray, selectedLeftMenuItem: dataArray[ 0 ] }) // 获取蛋糕列表 that.getCategoryItemsConnection(); } else { that.$wuxToast.show({ type: 'text' , timer: 1500 , color: '#fff' , text: '请求错误' , success: () => console.log( '请求错误' ) }) } }) }, // 获取分类数据 getCategoryItemsConnection: function () { var categoryId = that.data.selectedLeftMenuItem.category.id; //加载提示框 util.showLoading(); var urlStr = '/miniprogram/spu/list/' + categoryId; var parameters = "" ; util.request(urlStr, parameters, function (res) { var code = res.statusCode; if (code == 200 ) { util.hideToast(); var json = res.data; if ( typeof json != 'object' ) { if (json != null ) { json = json.replace( "/ufeff" , "" ); var jj = JSON.parse(json); res.data = jj; } } that.setData({ selectedProductList: res.data }) } else { that.$wuxToast.show({ type: 'text' , timer: 1500 , color: '#fff' , text: '请求错误' , success: () => console.log( '请求错误' ) }) } }) } }) |
找到原因:页面存在scroll-view,没有给scroll-view设置style="height: 100%",就这一个坑,导致了Android整个卡死,全屏白色
@LastLeaf 借楼问个问题
https://developers.weixin.qq.com/blogdetail?action=get_post_info&lang=zh_CN&token=1738446583&docid=24a7702edc87c935ff5d26df1a3078fc
这个是我之前问的一个问题, 能不能帮忙解答一下, 谢谢了~