pageScrollTo在开发工具中没问题,在苹果真机中却没有效果,这是为啥?

小程序 文章 2020-09-03 19:41 601 0 全屏看文

AI助手支持GPT4.0

pageScrollTo在开发工具中没问题,在苹果真机中却没有效果,这是为啥?pageScrollTo is fine in the development tool, but it has no effect in the real Apple machine. Why?

pageScrollTo在开发工具中没问题,在苹果真机中却没有效果,这是为啥?
onReady:function(){    let that = this;    var _id = that.data.commentId;    if(_id > 0){      console.log("pageScrollTo");      wx.pageScrollTo({        selector:'#Comment_'+_id,        duration100,        successres => {          console.log(res)        },        completeres => {          console.log(res)         }      });    }  } 在开发工具中执行没有问题,在iPhone7P的真机上没有滑动效果,且在真机上发现没有pageScrollTo方法返回,十分无奈,有能提供帮助的同学吗

onReady:function (){    let that = this;    var _ id =  that.data.commentId ;    if(_ id > 0){       console.log ("pageScrollTo");       wx.pageScrollTo ({        selector:'#Comment_ + + id,        duration: 100,        success: res => {           console.log (res)        },        complete: res => {           console.log (res)         }      }); There is no problem in the implementation of the development tool, there is no sliding effect on the iPhone 7p real machine, and there is no pagescrollto method return on the real machine, which is very helpless. Is there any student who can help

回答:

仙ღ₅₂₀¹³¹⁴:

提供可复现问题的代码片段。我尝试下。

https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

Admin²⁰²⁰:
  onReady: function () {    let that = this;    var _id = that.data.commentId;    if (_id > 0) {      console.log("pageScrollTo");      setTimeout(() => {        wx.pageScrollTo({          selector: "#Comment_" + _id,          duration: 100,          success: (res) => {            console.log(res);          },          complete: (res) => {            console.log(res);          },        });      }, 500);    }  },
菜菜:感谢回复,但是手机上还是不行,这是工具上方法执行的顺序,真机上我看的log日志,是先打印的pageScrollTo后打印的数组,请问和这个有关吗
Admin²⁰²⁰:setTimeOut时间调到1000或更大
Admin²⁰²⁰:或者放到setData的success回调里执行pageScrollTo,这样不用setTimeOut了
微喵网络:

iPhone没有滑动效果

菜菜:是的,本来应该自己滑动到某一个位置的,结果一动不动

-EOF-

AI助手支持GPT4.0