<viewclass="list"><viewclass="row"v-for="(item,index) in showList":key="index"><viewclass="txt">{{ index + 1 }}、{{item.title}}</view><viewclass="arrow"><fui-iconname="arrowright"color="#6C6B6B"size="34"></fui-icon></view></view><viewclass="replaceBtn"@click="replaceList"><imagesrc="/pages/userSub/static/images/replace.png"mode="aspectFill"></image>换一批</view></view>
<script setup>import{onLoad,onShow,onReachBottom}from'@dcloudio/uni-app'import i from'@/libs/common/index.js'import api from'@/request/api.js'import{nextTick,ref,shallowRef,reactive}from"vue";import{userStore}from'@/store/userStore.js'import{commonStore}from'@/store/commonStore.js'const user =userStore()const common =commonStore()const list =ref([])const showList =ref([])// 新增显示用的列表const page =ref(1)const size =ref(10000)const loadState =ref(1)onShow(()=>{getKeFuList()getKeFuInfo()})functiongetKeFuList(){api.getKeFuList({page: page.value,size: size.value,}).then(res=>{if(res.code ==1){list.value = res.data// 初始化显示三条replaceList()}})}functionreplaceList(){// 随机打乱数组并取前三个const shuffled =[...list.value].sort(()=> Math.random()-0.5)showList.value = shuffled.slice(0,3)}</script>