zoukankan      html  css  js  c++  java
  • 小程序scroll-view 实现瞄点

    <scroll-view :style="{height:autoHeight}" :scroll-y="true" @scrolltolower="scrolltolower" @scroll="scroll"  :scroll-into-view="toView" :scroll-with-animation="true" class="scroll-warp" :enable-back-to-top="true">
                        <div v-for="(item,index) in cityArr" :key="index">
                            <p class="title mb20" :id="item.initial">{{ item.initial }}</p>
                            <div class="cityBox">
                                <!-- :style="{marginRight:(childrenIndex%3 === 2) ? 0 : '26rpx' }" -->
                                <div v-for="(citys,childrenIndex) in item.chooseCitys" :key="childrenIndex">
                                    <div class="rowFlexBox" :class="{ activeFlex:citys.length === 2 }">
                                        <div v-for='(j,k) in citys' :key="k" :class="{ activeColor:activeIndex === childrenIndex && bgIndex === index && lastIndex === k }" class="cityStyle" @click="chooseCity(item,index,citys,childrenIndex,j,k)" >{{ j.short_name }}</div>
                                    </div>
                                    
                                </div>
                            </div>
                        </div>
                    </scroll-view>

    默认是toView:'A',

    // 选择的时候赋值上
    // chooseLetter 是你点击的地方,
    // toView  是你想要跳的地方
    chooseLetter(item,index){
                    this.Tips(item);
                    if (item === 'A') {
                        this.toView = 'A' ;
                    } else {
                        this.toView = item ;
                    }
                    console.log(this.toView,'this.toView')
    
                },

    作者:人参,每篇随笔皆原创(除非注明原作者的随笔),欢迎指正!

  • 相关阅读:
    利用django创建一个投票网站(二)
    利用django创建一个投票网站(一)
    django models进行数据库增删查改
    用pyspider爬淘宝MM照片
    爬虫实现模拟登陆豆瓣
    python-study-32
    python-study-31
    python-study-30
    python-周考2
    python-周考3
  • 原文地址:https://www.cnblogs.com/panax/p/14464507.html
Copyright © 2011-2022 走看看