猿问

小程序一个page里有两个列表页,滑动互相影响,怎么解决?

如上图:活动页中有两个标签页:招聘会、宣讲会,在滑动招聘会时宣讲会列表也会滑动,有什么办法使得宣讲会列表不响应滑动事件?

<import src="activity-stu-template/activity-stu-template.wxml" />
<import src="activity-tea-template/activity-tea-template.wxml" />
<view class="container">

  <!--指示器,切换活动类型:宣讲会、招聘会-->
  <view class="indicator">
    <text bindtap="switchIndicator" data-activity-type="jobfair" style="color:{{activityType == ACTIVITY_TYPE_JOBFAIR?'#555555':'#aaaaaa'}}">招聘会</text>
    <text bindtap="switchIndicator" data-activity-type="teachin" style="color:{{activityType == ACTIVITY_TYPE_TEACHIN?'#555555':'#aaaaaa'}}">宣讲会</text>
  </view>

  <!--对应指示器的内容-->

  <!--学生视图-->
  <scroll-view id="stu" class="listview"  scroll-y wx:if="{{userInfo.utype == 'student'}}">
    <!--招聘会视图-->
    <view  hidden="{{!(activityType == ACTIVITY_TYPE_JOBFAIR)}}">
      <block wx:for="{{jobfairDatas}}" wx:for-item="data" wx:key="{{data.activityId}}">
        <view class="listview-item" catchtap="onItemClick" data-index="{{index}}" >
          <template is="t_activity_stu" data="{{...data}}"></template>
        </view>
      </block>
    </view>

    <!--宣讲会视图-->
    <view hidden="{{!(activityType == ACTIVITY_TYPE_TEACHIN)}}">
      <block wx:for="{{teachinDatas}}" wx:for-item="data" wx:key="{{data.activityId}}">
        <view class="listview-item"  catchtap="onItemClick" data-index="{{index}}">
          <template is="t_activity_stu" data="{{...data}}"></template>
        </view>
      </block>
    </view>
  </scroll-view>

  <!--教师视图-->
  <scroll-view id="tea" class="listview" scroll-y wx:else>

    <!--招聘会视图-->
    <view hidden="{{!(activityType == ACTIVITY_TYPE_JOBFAIR)}}">
      <block wx:for="{{jobfairDatas}}" wx:for-item="data" wx:key="{{data.activityId}}">
        <view class="listview-item"  catchtap="onItemClick" data-index="{{index}}">
          <template is="t_activity_tea" data="{{...data}}"></template>
        </view>
      </block>
    </view>

    <!--宣讲会视图-->
    <view hidden="{{!(activityType == ACTIVITY_TYPE_TEACHIN)}}">
      <block wx:for="{{teachinDatas}}" wx:for-item="data" wx:key="{{data.activityId}}">
        <view class="listview-item"  catchtap="onItemClick" data-index="{{index}}">
          <template is="t_activity_tea" data="{{...data}}"></template>
        </view>
      </block>
    </view>
  </scroll-view>
</view>

上面代码是活动页的布局

adn_boy
浏览 3344回答 1
1回答

MR帽子先生

分别建立两个大的标签容器,把招聘会、宣讲会分别放进去 隐藏的时候隐藏外部容器就行了,按照你的思路是老师和学生分开但是老师的招聘会、宣讲会,是在一个scroll-view里面,这导致了你拖动一个会带着另一个一起动,我写的话老师和学生在一块,使用权限来分开。
随时随地看视频慕课网APP
我要回答