<view class="sticky-box" :style="'top:'+(marTop)+'px;'"> <scroll-view class="scroll-view_H" style="width: 100%;" scroll-x="true" scroll-with-animation :scroll-left="tabsScrollLeft" @scroll="scroll"> <view class="tab nav-bd" id="tab_list"> <view id="tab_item" :class="{ 'active': listActive == index}" class="item" v-for="(item, index) in explosiveMoney" :key="index" > <view class="txt">{{item.name}}</view> <video class="label">{{item.video}}</video> </view> </view> </scroll-view> </view> .sticky-box { /* #ifndef APP-PLUS-NVUE */ display: flex; position: -webkit-sticky; /* #ifdef H5*/ top: var(--window-top); /* #endif */ z-index: 99; flex-direction: row; margin: 0px; background: #f5f5f5; padding: 30rpx 0; }将他修改为只用来显示文字和视频,文字在视频上方,视频和文字居中对齐,一行只显示一个文字或者视频,将多余的代码删除
时间: 2023-08-05 20:07:31 浏览: 106
react-sticky-el
以下是修改后的代码:
```
<view class="sticky-box">
<scroll-view class="scroll-view_H" style="width: 100%;" scroll-x="true" scroll-with-animation :scroll-left="tabsScrollLeft" @scroll="scroll">
<view class="tab nav-bd" id="tab_list">
<view id="tab_item" :class="{ 'active': listActive == index}" class="item" v-for="(item, index) in explosiveMoney" :key="index">
<view class="txt">{{item.name}}</view>
<video class="label" style="display: block; margin: 0 auto;">{{item.video}}</video>
</view>
</view>
</scroll-view>
</view>
```
这里只保留了文字和视频的显示,文字在视频上方,使用样式 `display: block; margin: 0 auto;` 使视频和文字居中对齐,且一行只显示一个文字或者视频。同时删除了多余的样式代码。
阅读全文