收藏
回答

scroll-view组件的scroll-into-view属性获取不到元素id?

bindscroll="swichNav"函数获取不到元素id

<scroll-view scroll-y="true" scroll-with-animation="true" refresher-enabled="true" enhanced="true" scroll-into-view="{{rowView}}" scroll-top="{{scrollTop}}" bindscroll="swichNav" class="task_view" style="height:{{menuHeight}}px">
    <view class="item_scroll">
      <block wx:for="{{task}}" wx:for-index="index" wx:key="item">
        <text id="row_{{index}}" style="color: #ffffff;">{{item.time}}</text>
        <view wx:for="{{item.shop}}" wx:for-item="items" wx:key="item" class="shop">
          <text>{{items.name}}</text>
          <text class="shop_order">20</text>
          <view class="flex-center shop_info">
            <image class="avatar_35" mode="aspectFill" lazy-load="true" src="cloud://ohho-0g07i44qa70ce331.6f68-ohho-0g07i44qa70ce331-1304584431/icon/default_img.png"></image>
            <view class="flex-center">
              <text>距您</text>
              <text>1230/m</text>
            </view>
          </view>
        </view>
      </block>
    </view>
  </scroll-view>


bindscroll="swichNav"函数

swichNav: function (e) {
    console.log(e.currentTarget);
  },


回答关注问题邀请回答
收藏

1 个回答

  • 来一间
    来一间
    2021-12-24

    滚动是返回的是event.detail = {scrollLeft, scrollTop, scrollHeight, scrollWidth, deltaX, deltaY},直接拿元素id获取元素位置不就可以了吗

    2021-12-24
    有用 2
    回复
登录 后发表内容