1.定义响应式变量
const currentInfo = ref(null);
2.给这个变量每个图片赋对应的值
onLoad((e) => {
currentId.value = e.id;
currentIndex.value = classList.value.findIndex(item => item._id == currentId.value);
currentInfo.value = classList.value[currentIndex.value];
console.log(currentIndex.value);
})
const swipperChange = (e) => {
currentIndex.value = e.detail.current;
currentInfo.value = classList.value[currentIndex.value];
console.log(e);
}
3.渲染页面
<uni-popup ref="infoPopup" type="bottom">
<view class="infoPopup">
<view class="popHeader">
<view></view>
<view class="title">壁纸信息</view>
<view class="close" @click="clickInfoClose">
<uni-icons type="closeempty" size="18" color="#999"></uni-icons>
</view>
</view>
<scroll-view scroll-y>
<view class="content">
<view class="row">
<view class="label">壁纸ID:</view>
<text selectable class="value">{{currentInfo._id}}</text>
</view>
<!-- <view class="row">
<view class="label">分类:</view>
<text selectable class="value class">明星美女</text>
</view> -->
<view class="row">
<view class="label">发布者:</view>
<text selectable class="value">{{currentInfo.nickname}}</text>
</view>
<view class="row">
<view class="label">评分:</view>
<view class="value roteBox">
<uni-rate readonly touchable :value="currentInfo.score" size="16" />
<text class="score">{{currentInfo.score}}</text>
</view>
</view>
<view class="row">
<view class="label">摘要:</view>
<text selectable class="value">{{currentInfo.description}}
</text>
</view>
<view class="row">
<view class="label">标签:</view>
<view class="value tabs">
<view class="tab" v-for=" tab in currentInfo.tabs">{{tab}}</view>
</view>
</view>
<view class="copyright">
声明:如有侵权请如我联系,会妥善处理
</view>
</view>
</scroll-view>
</view>
</uni-popup>