video.wxml 2.34 KB
<view class="videoContainer">
  <!-- 头部区域 -->
  <view class="header">
    <image src="/static/images/video/video.jpg"></image>
    <view class="search" bindtap="toSearch">
      음악 검색
    </view>
    <image src="/static/images/logo.png"></image>
  </view>

  <!-- 导航区域 -->
  <scroll-view
      scroll-x
      class="navScroll"
      enable-flex
      scroll-into-view="{{'scroll' + navId}}"
      scroll-with-animation
  >
    <view id="{{'scroll' + item.id}}" class="navItem" wx:for="{{videoGroupList}}" wx:key="id">
      <view class="navContent {{navId === item.id?'active': ''}}" bindtap="changeNav" id="{{item.id}}" data-id="{{item.id}}">
        {{item.name}}
      </view>
    </view>
  </scroll-view>

  <!-- 视频列表区域 -->
  <scroll-view
      scroll-y
      class="videoScroll"
      refresher-enabled
      bindrefresherrefresh="handleRefresher"
      refresher-triggered="{{isTriggered}}"
      bindscrolltolower="handleToLower"
  >
    <view class="videoItem" wx:for="{{videoList}}" wx:key="id">
      <video
          src="{{item.data.urlInfo.url}}"
          bindplay="handlePlay"
          id="{{item.data.vid}}"
          poster="{{item.data.coverUrl}}"
          class="common"
          object-fit="cover"
          wx:if='{{videoId === item.data.vid}}'
          bindtimeupdate="handleTimeUpdate"
          bindended="handleEnded"
      ></video>

      <!-- 性能优化:使用image图片代替video标签 -->
      <image wx:else bindtap="handlePlay" id="{{item.data.vid}}" class="common" src="{{item.data.coverUrl}}"></image>


      <view class="content">{{item.data.title}}</view>

      <view class="footer">
        <image class="avatar" src="{{item.data.creator.avatarUrl}}"></image>
        <text class="nickName">{{item.data.creator.nickname}}</text>
        <view class="comments_praised">
          <text class="item">
            <text class="iconfont icon-buoumaotubiao15"></text>
            <text class="count">{{item.data.praisedCount}}</text>
          </text>
          <text class="item">
            <text class="iconfont icon-pinglun1"></text>
            <text class="count">{{item.data.commentCount}}</text>
          </text>
          <button open-type="share" class="item btn">
            <text class="iconfont icon-gengduo"></text>
          </button>
        </view>
      </view>
    </view>
  </scroll-view>
</view>