文件
NHCshopro/uniapp/pages/message/message.vue
wikiboss f141d35f1c Add 'uniapp/' from commit '096e31448ca089004c78af69f2006c2b0324d8a4'
git-subtree-dir: uniapp
git-subtree-mainline: b87880e247
git-subtree-split: 096e31448c
2026-11-20 09:08:51 +08:00

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>