wechat-miniprogram / wechat-miniprogram/miniprogram-demo

[scroll-view] scroll-view.js中的tap和tapMove没有用上

Open
#48 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
7.2k
Forks
2.2k
Avg merge
10h 34m
Merged PRs (30d)
2

Description

scroll-view.wxml里没有地方bind到这两个函数上。所以scroll-into-view属性和scroll-top属性也没有作用,因为两个变量根本就不会变。

根据tap的实现,我猜是想在纵向滚动中实现点一下就跳到下一个方块。
可以改一下tap函数:

  tap() {
    for (let i = 0; i < order.length; i = (i + 1) % order.length) {
      if (order[i] === this.data.toView) {
        let next = (i + 1) % order.length
        this.setData({
          toView: order[next],
          scrollToTop: next * 200
        })
        break
      }
    }
  }

初始化时,js中的data里,toView写错了,数组里没有green这项,改成demo1:

  data: {
    toView: 'demo1',
    triggered: false,
  },

再把tap绑定到纵向滚动的scroll-view上:

        <scroll-view scroll-y="true" style="height: 150px;" bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" scroll-into-view="{{toView}}" bindtap="tap">

tapMove感觉没有什么意义。另外ScrollToTop不知道是起什么作用的。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect scroll-view.wxml and scroll-view.js, starting with the vertical scroll-view bindings and the tap, tapMove, and ScrollToTop entry points. Verify which data values drive scroll-into-view and scroll-top, then confirm that tapping advances the vertical demo and that unused behavior is resolved or documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.