想实现点击左侧 级别,右侧跟随滚动,但是试了几次均未实现,下面附上demo

wxml

<scroll-view scroll-y="true" scroll-into-view="{{toView}}"  style="height: 6000px;">  

<view id='{{item.wordindex}}' class="brand" wx:for="{{brandList}}" >  

<view class="line"></view>  

<view class="wordindex">{{item.wordindex}}</view>  

<view class="line"></view>  

<view class="brand_block">  

<view class="color_view" wx:for="{{item.brand}}" bindtap="click">  

<image src="{{item.brandimg}}"></image>  

</view>  

</view>  

</view>  

</scroll-view>  

<view class="index">  

<text wx:for="{{wordindex}}" bindtap="choiceWordindex" data-wordindex="{{item.wordindex}}">  

{{item.wordindex}}

</text>  

</view>


wxss

/* pages/order/car/add_car/car_brand/car_brand.wxss */  

scroll-view {

height: 600px;

float: left;

width: 94%;

}

.wordindex {

line-height: 50rpx;

background: #f7f7f7;

font-size: 14px;

color: #929292;

padding-left: 28rpx;

}

.color_view {

text-align: center;

display: inline-flex;

flex-direction: column;

}

.brand_block {

margin-top: 28rpx;

margin-left: 28rpx;

}

image {

width: 140rpx;

height: 140rpx;

margin-right: 24rpx;

margin-bottom: 24rpx;

border-style: solid;

border-width: 1rpx;

border-color: #ededed;

}

.index {

float: right;

position: fixed;

right: 0;

margin-top: 20%;

margin-right: 10rpx;

color: #e0004a;

font-size: 11px;

}

.index text {

display: flex;

line-height: 18rpx;

}


js


var app = getApp()

Page({

data: {

"brandList": [],

"wordindex": [],

"toView": 'a',


},

onLoad: function (options) {

var that = this;

that.setData({

brandList: [{ wordindex: 'a' }, { wordindex: 'b' }, { wordindex: 'c' }, { wordindex: 'd' }, { wo

展开全部
收起
2回答
提交回答
  • 至过去的我

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
  • 相亲相爱

    17人对此回答表示赞同

    wechatide://minicode/5BljGUmd6tYg您看下这个可以吗

    展开
    17
    0回复
    发布于 6年前

    评论(0)

    收起评论

  • 我是静静

    5人对此回答表示赞同

    麻烦给个相关的代码片段,我们定位下问题

    展开
    5
    0回复
    发布于 6年前

    评论(0)

    收起评论

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
咨询热线

13312967497

扫码添加业务即可随时咨询 还可领取小程序推广攻略

业务咨询: 13312967497
扫码咨询

扫码咨询套餐

回到顶部