加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

微信小程序实现A-Z导航的Slidebar

发布时间:2020-12-14 19:05:45 所属栏目:资源 来源:网络整理
导读:微信小程序实现A-Z导航的Slidebar 效果 代码 slidebar.wxml view id = "s-bar" class "slidebar" bindtouchstart "_onTouchStart" bindtouchmove "_onTouchMove" bindtouchend "_onTouchEnd" wx:for "{{data}}" "slide-item" "item-{{index}}" wx:key "{{ind

微信小程序实现A-Z导航的Slidebar

效果

代码

slidebar.wxml

  1. <view id="s-bar"class"slidebar"bindtouchstart"_onTouchStart"bindtouchmove"_onTouchMove"bindtouchend"_onTouchEnd">
  2. wx:for"{{data}}""slide-item""item-{{index}}"wx:key"{{index}}">
  3. >{{item.key}}</text>
  4. </view>
  5. animation"{{animationData}}"bindtransitionend"_onAnimationend">
  6. </view>

slidebar.wxss

.slidebar{
  • right 0rpx;
  • width60rpx;
  • }
  • display flex;
  • items3.9vh fontsize24rpx color #222222;
  • lineheight;
  • }
  • 40rpx inlineblock}
  • 500#ffffff;
  • 50%;
  • top%;
  • left125rpx250rpx72rpx#ffffff;
  • }
  • // components/slidebar/slidebar.js
  • Component({
  • * 组件的属性列表
  • properties{
  • type Array,
  • { key "A"},
  • "C""E""G""I""J" ]
  • * 组件的初始数据
  • data selectedIndex1 currentKey"" closeKeyDialogfalse animationData{},0);"> lifetimes attachedfunction(){
  • thisisTouch =dataforEach((di)=>{
  • });
  • duration1000 timingFunction'ease'});
  • /**
  • */
  • truesetData({
  • });
  • _onTouchMove){
  • _onTouchEnd){
  • /**
  • */
  • var query createSelectorQueryin();
  • selectViewport().scrollOffset();
  • resolve});
  • */
  • for=;<length++){
  • ify >= d&& y <= ifselectedIndex ==){
  • _setSlideItemSelectStatus);
  • }
  • data currentKey selectedIndex i
  • console"动画结束")
  • /**
  • */
  • )=>{
  • );
  • updateItemSelectedByIndexindexindex >0 index <],0);"> index})

  • (编辑:李大同)

    【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

      推荐文章
        热点阅读