安卓与ios的坑
发布于 5 年前 作者 xiuyingsu 10317 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

在ios上scroll-top滚动不起作用,安卓上测试时,就可以正常滚动

  • 预期表现
  • 复现路径
  • 提供一个最简复现 Demo
3 回复

提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

请问你的问题是怎么解决的呢?能分享下吗?

//问题答案的单选按钮选择处理 questionValChange: function(event) { console.log(“问题答案的单选按钮选择处理—questionValChange”) var that = this;

var questions = this.data.questions;
var checkItemKey = event.detail.value;



//因为每条条目id是questionID,因此使用id拿到对应数组时必须减1
// console.log(event.currentTarget.id); // 1, 2, 3 ... 66
// console.log(checkItemKey); // 0, 1, 2, 3, 或者4
var currentId = event.currentTarget.id - 1;
var imgsArr = ["never.png", "seldom.png", "sometimes.png", "often.png", "always.png"];
var imgsCheckedArr = ["never_checked.png", "seldom_checked.png", "sometimes_checked.png", "often_checked.png", "always_checked.png"];
var answerArr = ["没有", "很少", "有时", "经常", "总是"];
var tempOptionArray = questionOptions;
if (currentId > currentId - 1) {
  var newScrollTop = this.data.scrollTop + 120;

  that.setData({
    scrollTop: newScrollTop
  })
}

//遍历条目对象的checked属性,设置选中或未选中的样式
for (var i = 0; i < questions[currentId].questionVals.length; i++) {
  if (i == checkItemKey) {
    questions[currentId].answer = answerArr[i];
    scores[currentId] = i + 1;
    tempOptionArray[i].checked = true;
    tempOptionArray[i].img = imgsCheckedArr[i];
  } else {
    tempOptionArray[i].checked = false;
    tempOptionArray[i].img = imgsArr[i];
  }
}
questions[currentId].questionVals = tempOptionArray;
that.setData({
  questions: questions,
});

setTimeout(function() {
  console.log("currentId=" + (currentId + 2))
  var value = (currentId)
  var temp = 0;
  //从当前选项开始查找下一个未填的选项
  for (var j = value; j < questions.length; j++) {
    if (questions[j].answer == null) {
      that.setData({
        showId: j + 1,
      });
      temp = 1;
      break
    } else {
      temp = 0;
    }
  }
  //如果temp=0在从头循环一遍查找是否还有未填写的选项
  if (temp == 0) {
    for (var j = 0; j < questions.length; j++) {
      if (questions[j].answer == null) {
        that.setData({
          showId: j + 1,
        });
        break
      }
    }
  }
  that.checkFinishedAll(currentId);
  console.log("问题" + questions[currentId].questionID + "...答案:" + questions[currentId].answer)
}, 400)

},

{{item.question}}
回到顶部