63 行
1.4 KiB
Vue
63 行
1.4 KiB
Vue
<template>
|
|
<view class="padding">
|
|
<view class="margin-bottom-sm flex bg-white padding" style="border-radius: 16rpx;" v-for="item in list" @tap="toPage(`./detail?id=${item.id}`)">
|
|
<view class="flex-sub margin-right-sm flex flex-direction justify-between" style="overflow: hidden;">
|
|
<view class="text-cut text-lg text-bold">{{item.title}}</view>
|
|
<view class="text-cut text-df" style="color: #666;">
|
|
{{item.desc}}
|
|
</view>
|
|
<view class="text-sm text-gray">{{item.views}}浏览</view>
|
|
</view>
|
|
<image style="width: 192rpx;height: 144rpx;border-radius: 20rpx;" :src="item.cover | getImgUrl" mode="aspectFill"></image>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
list: [],
|
|
pageData: {
|
|
page: 1,
|
|
loadMoreState: 'loadmore'
|
|
}
|
|
}
|
|
},
|
|
onReachBottom() {
|
|
if(this.pageData.loadMoreState == 'nomore') return
|
|
this.pageData.page += 1
|
|
|
|
this.getList()
|
|
},
|
|
methods: {
|
|
async init() {
|
|
this.getList()
|
|
},
|
|
getList() {
|
|
uni.showLoading()
|
|
return this.$http('notice.list', {
|
|
...this.pageData
|
|
}).then(res => {
|
|
uni.hideLoading()
|
|
if(res.data.list && res.data.list.length > 0) {
|
|
this.list = this.list.concat(res.data.list)
|
|
this.pageData.loadMoreState = 'loadmore'
|
|
}else {
|
|
this.pageData.loadMoreState = 'nomore'
|
|
}
|
|
})
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.init()
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
page{
|
|
background-color: #f5f5f5;
|
|
}
|
|
</style>
|