Files
xdd-uniapp-new/pkg_product/views/famousStory.vue
T

64 lines
1.3 KiB
Vue

<template>
<view class="famous-story">
<image class="img" :src="item.image" mode="scaleToFill" v-for="item in list" @click="goHot(item)"/>
</view>
</template>
<script>
import {getStoryList} from "@/api/product";
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: "famousStory",
mixins: [pageListenMixins],
data() {
return {
page: 1, // 当前页
pages: 1, // 总页数
list: [],
pageKeyId: Object.freeze('countyFamousContentList')
}
},
onLoad() {
this.fetchData()
},
onReachBottom() {
if (this.page < this.pages) {
this.page++
this.fetchData()
}
},
methods: {
fetchData() {
getStoryList(this.page).then(({data}) => {
this.pages = data.pages
if (data.records.length > 0) {
for (let i = 0; i < data.records.length; i++) {
this.list.push(data.records[i])
}
}
})
},
goHot(item) {
uni.navigateTo({
url: '/pkg_product/views/famousHot?id=' + item.id
})
}
}
}
</script>
<style scoped lang="less">
.famous-story {
padding-top: 20rpx;
background: #fff;
.img {
width: 686rpx;
height: 440rpx;
margin: 0 32rpx 32rpx;
border-radius: 20rpx;
}
}
</style>