71 lines
1.3 KiB
Vue
71 lines
1.3 KiB
Vue
<template>
|
|
<view class="famous-story">
|
|
<image
|
|
v-for="(item, index) in list"
|
|
:key="index"
|
|
:src="item.image"
|
|
class="img"
|
|
mode="scaleToFill"
|
|
@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>
|