You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

74 lines
1.6 KiB

<template>
<view class="">
<block v-for="(item, index) in communityList" :key="index">
<view @click="toDetails(item.id)" style="border-bottom: 1px solid #efefef;">
<pic-text :isDetail="isClass" :info="item" :index="index" :stopVideo="stopVideo" :currentPlay="currentPlay" @changePlay="changePlay()"></pic-text>
</view>
</block>
</view>
</template>
<script>
import App from '@/common/js/app.js';
import picText from "@/components/template/pic_text/pic_text.vue"
export default {
data(){
return {
stopVideo: 0,
scrollTimer: null,
currentPlay: -2,//当前正在播放的视频在列表中的索引,-2表示没有正在播放
}
},
props:{
scrollLock: {
type: Boolean
},
communityList: {
type: Array
},
isClass: {
// 首页false、分类页true
type: Boolean,
default: false
}
},
components:{
picText
},
watch: {
scrollLock: {
handler(newVal, oldVal){
this.handlerScroll();
}
}
},
created() {
},
methods: {
// 跳转正文详情
toDetails(id){
uni.navigateTo({
url:"/pagesA/pictureTextDetails/pictureTextDetails?id=" + id
})
},
handlerScroll(){
if(this.scrollLock){
clearTimeout(this.scrollTimer);
}
this.scrollTimer = setTimeout(()=>{
// this.scrollLock = false;
this.$emit('changeScrollLock', false)
this.stopVideo++;
}, 500)
},
changePlay(e){
this.stopVideo++;//先关闭上一个播放的按钮,再改变当前播放索引=最新播放视频索引
this.currentPlay = e;
}
}
}
</script>
<style>
</style>