when using swiper-item in swiper, swiper-item needs to do more pull-up and load, while the document says that swiper needs a fixed height.
how to solve this
see an article on the Nuggets, but I still can"t solve it
when using swiper-item in swiper, swiper-item needs to do more pull-up and load, while the document says that swiper needs a fixed height.
how to solve this
see an article on the Nuggets, but I still can"t solve it
<view class='tab'>
<view class='tab-menu'>
<view class='menu' wx:for="{{tabs}}" wx:key="{{index}}" data-tabidx="{{index}}" bindtap='switchTab'>
<text>{{item}}</text>
<view class='currentTab' wx:if="{{tabIdx === index}}"></view>
</view>
</view>
<swiper class='tab-content' current='{{tabIdx}}' bindchange='scrollTab'>
<swiper-item>
<view class='question-wrap'>
<view class='question-header'>
<text>[{{questions[current].type}}]</text>
<text class='total'><text class='current'>{{current+1}}</text>/{{questions.length}}</text>
</view>
<view class='title'>{{questions[current].title}}</view>
<view class='options'>
<view class='opt {{questions[current].right === index ? "right" : ""}}' wx:for="{{questions[current].options}}" wx:key="{{index}}">
<view class='tag'>
<image src='/icons/right.png' wx:if="{{questions[current].right === index}}"></image>
</view>
<view class='content'>{{item.content}}</view>
<text class='rate'>{{item.rate}}</text>
</view>
</view>
</view>
<view class='btns'>
<button disabled='{{current <= 0}}' bindtap="showPre"></button>
<button disabled='{{current >= questions.length-1}}' bindtap="showNext"></button>
</view>
</swiper-item>
<swiper-item>
<scroll-view scroll-y class='totalRank' lower-threshold="150" bindscrolltolower="getRank">
<view class='user' wx:for="{{ranks}}" wx:key="{{index}}">
<image src='{{item.img_url}}' class='avator'></image>
<view class='name'>{{item.name}}</view>
<view class='score'>{{item.score}}</view>
<view class='order'>{{item.no}}</view>
</view>
</scroll-view>
</swiper-item>
</swiper>
</view>
page {
display: flex;
flex-direction: column;
height: 100%;
background: -sharpfff;
font-size: 30rpx;
}
.tab {
flex: 1;
display: flex;
flex-direction: column;
}
.tab-content {
flex: 1;
overflow-y: auto;
}
.tab-menu {
height: 104rpx;
display: flex;
}
.currentTab {
background: -sharp42c541;
height: 2rpx;
width: 132rpx;
position: absolute;
bottom: 20rpx;
}
.tab-menu .menu {
flex: 1;
text-align: center;
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
swiper-item {
overflow: auto;
}
.totalRank {
height: 100%;
}
.avator {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
}
.user {
height: 88rpx;
display: flex;
align-items: center;
background: -sharpf4f4f4;
padding: 0 43rpx;
margin: 30rpx 30rpx 0 30rpx;
border-radius: 10rpx;
box-sizing: border-box;
font-size: 24rpx;
}
.name, .score, .order {
flex: 1;
text-align: center;
}
.name{
margin-left: 50rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.order {
color: -sharp42c541;
text-align: right;
}
.question-wrap{
display: flex;
flex-direction: column;
margin: 0 30rpx;
border: 2rpx solid -sharpDCDCDC;
border-radius: 10rpx;
box-sizing: border-box;
padding: 0 50rpx;
margin-top: 40rpx;
}
.question-header{
display: flex;
justify-content: space-between;
margin-top: 60rpx;
}
/* .question-wrap .options{
max-height: 600rpx;
overflow: auto;
} */
.question-header .total{
color: -sharpE3E3E3;
}
.question-header .current{
color: -sharp353535;
}
.question-wrap .title{
margin-top: 36rpx;
min-height: 178rpx;
}
.opt{
text-align: center;
position: relative;
background: -sharpF0F0F0;
margin-bottom: 44rpx;
border-radius: 10rpx;
padding: 26rpx 20rpx;
display: flex;
align-items: center;
}
.opt image, .opt .tag{
width: 46rpx;
height: 34rpx;
}
.opt .rate{
min-width: 3em;
}
.opt .content{
flex: 1;
text-align: center;
}
.right{
background: -sharpFF920B;
color: -sharpFFF;
}
.btns{
display: flex;
margin-top: 60rpx;
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: 148rpx;
}
.btns button{
width: 260rpx;
height: 88rpx;
line-height: 88rpx;
text-align: center;
border-radius: 10rpx;
color: -sharpFFF;
background: -sharp41C629;
}
.btns button:active{
background: -sharp179B16;
color: -sharpA2D7A2;
}
.btns button[disabled]:active{
background: -sharpF7F7F7;
color: -sharpACACAC;
}
Page({
data: {
tabs: [
'',
''
],
ranks: [
{ name: '', score: 93 },
{ name: '', score: 60 },
{ name: '', score: 8 },
{ name: '', score: 1000 },
{ name: '', score: 45 }
],
questions: [],
current: 0,
tabIdx: 0
}
})
https://developers.weixin.qq., can solve the problems you encounter, very simple
Previous: Two-column layout, the second column width is fixed, I use float second column why not go up?