|
|
- <template>
- <view class="postList">
-
- <navbar
- leftClick
- @leftClick="$utils.navigateBack"
- title="动态列表"/>
-
- <view class="title">
- 动态列表
- </view>
-
- <view class="box">
- <view class="search">
- <view class="icon">
- <uv-icon
- size="40rpx"
- name="search"></uv-icon>
- </view>
- <input type="text" placeholder="搜索相关..."
- v-model="queryParams.title"
- />
- <view class="text"
- @click="indexGetTrendsPage">
- 搜索
- </view>
- </view>
-
- <postList :list="postList"/>
- </view>
- </view>
- </template>
-
- <script>
- import postList from '@/components/post/postList.vue'
- export default {
- components : {
- postList
- },
- data() {
- return {
- postList : [],
- total : 0,
- queryParams : {
- pageNo : 1,
- pageSize : 10,
- title : '',
- },
- }
- },
- onShow() {
- this.queryParams.pageNo = 1
- this.indexGetTrendsPage(res => {
- this.postList = res.result.records
- })
- },
- //滚动到屏幕底部
- onReachBottom() {
- let total = this.queryParams.pageNo * this.queryParams.pageSize
- if(total < this.total){
- this.queryParams.pageSize += 10
- this.indexGetTrendsPage(res => {
- this.postList.push(...res.result.records)
- })
- }
- },
- methods: {
- indexGetTrendsPage(fn){
- this.$api('indexGetTrendsPage',
- this.queryParams, res => {
- if(res.code == 200){
- // fn && fn(res)
- this.postList = res.result.records
- this.total = res.result.total
- }
- })
- },
- }
- }
- </script>
-
- <style lang="scss" scoped>
- .postList{
- .title{
- padding-top: 20rpx;
- padding-left: 30rpx;
- font-size: 32rpx;
- }
- .box{
- padding: 30rpx;
- .search{
- background-color: #fff;
- height: 70rpx;
- width: 100%;
- margin: 20rpx 0;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 28rpx;
- border-radius: 10rpx;
- .icon{
- margin: 0 20rpx;
- }
- input{
-
- }
- .text{
- margin-left: auto;
- margin-right: 20rpx;
- }
- }
- }
- }
- </style>
|