小程序scroll-view实现定位锚点

小程序scroll-view 实现定位锚点 scroll-into-view属性设置要展示部分的id,scroll-with-animation="true"设置动画效果 ,scroll-view 容器要设置高度

<scroll-view scroll-into-view="{{toView}}" style="height:400px" scroll-y="true" scroll-with-animation="true">
      <view>
        <view class="table-list">
          <view style="display:flex">
          <view style="width:13px;height:13px;border-radius:50%;background:#3F8ADF;margin-right:10px;margin-top:9px"></view>
          <view class="tableTitle" id="xsjl">我的销售录入记录</view>
          </view>
          <view style="overflow:scroll;">
            <view class="tableTh">
              <view class="th">单据日期</view>
              <view class="th">订单编号</view>
              <view class="th">BA姓名</view>
              <view class="th">会员手机号</view>
              <view class="th">会员姓名</view>
              <view class="th">原价金额</view>
              <view class="th">实收金额</view>
            </view>
            <view class="tableTh" wx:for="{{list}}" wx:key="index">
            <view class="tr">{{item.riqi}}</view>
            <view class="tr">{{item.num}}</view>
            <view class="tr">{{item.baName}}</view>
            <view class="tr">{{item.phone}}</view>
            <view class="tr">{{item.name}}</view>
            <view class="tr">{{item.price}}</view>
            <view class="tr">{{item.reaPrice}}</view>
            </view>
          </view>
        </view> 
        <view class="table-list">
          <view  class="tableTitle " id="hejl">
          <view style="display:flex">
          <view style="width:13px;height:13px;border-radius:50%;background:#3F8ADF;margin-right:10px;margin-top:7px"></view>
          我的核销记录</view>
        </view>
          <view style="overflow:scroll;">
              <view class="tableTh">
                <view class="th">核销日期</view>
                <view class="th">核销类型</view>
                <view class="th">BA姓名</view>
                <view class="th">会员手机号</view>
                <view class="th">会员姓名</view>
                <view class="th">核销明细</view>
              </view>
              <view class="tableTh" wx:for="{{list}}" wx:key="index">
              <view class="tr">{{item.riqi}}</view>
              <view class="tr">{{item.num}}</view>
              <view class="tr">{{item.baName}}</view>
              <view class="tr">{{item.phone}}</view>
              <view class="tr">{{item.name}}</view>
              <view class="tr">{{item.price}}</view>
              </view>
          </view>
        </view>
      </view>
    </scroll-view>
    //  js部分  在上面data中先声明变量toView:'default'
    changeSilder(e){
    // console.log(e.currentTarget.dataset);
    if(e.currentTarget.dataset.current == '01'){
      this.setData({
        toView: "xsjl"
      })
    }else if(e.currentTarget.dataset.current == '02'){
      this.setData({
        toView: "hejl"
      })
    }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值