zoukankan      html  css  js  c++  java
  • 博客时间线和分页功能实现

    1.效果图

    上面的页面,有两个功能要点:时间线和分页

    Blog.vue

    <template>
      <div>
        <Header></Header>
        <div class="block">
          <el-timeline>
            <el-timeline-item :timestamp="blog.created" placement="top" v-for="blog in blogs" :key="blog">
              <el-card>
              <h4>
                  <router-link :to="{name: 'BlogDetail', params: {blogId: blog.id}}">
                      {{blog.title}}
                  </router-link>
                </h4>
              <p>{{blog.description}}</p>
              </el-card>
            </el-timeline-item>
          </el-timeline>
    
          <el-pagination class="mpage"
            background
            layout="prev, pager, next"
            :current-page="currentPage"
            :page-size="pageSize"
            :total="total"
            @current-change=page
            >
           </el-pagination>
        </div>
      </div>
    </template>
    
    <script>
    import Header from '../components/Header'
    export default {
      name: 'Blogs.vue',
      components: {Header},
      data () {
        return {
          blogs: {},
          currentPage: 1,
          total: 0,
          pageSize: 5
        }
      },
      methods: {
        page (currentPage) {
          const _this = this
          _this.$axios.get('/blogs?currentPage=' + currentPage).then(res => {
            console.log(res)
            _this.blogs = res.data.data.records
            _this.currentPage = res.data.data.current
            _this.total = res.data.data.total
            _this.pageSize = res.data.data.size
          })
        }
      },
      created () {
        this.page(1)
      }
    }
    </script>
    <style scoped>
      .mpage {
        margin: 0 auto;
        text-align: center;
      }
    </style>
    

      BlogController.java

  • 相关阅读:
    app测试点
    【Android自动化打包】03. APK的数字签名
    【转】测试架构师团队的管理
    【转】用户体验质量的测试方法论-“你的风扇方案”
    【转】大数据本质与测试
    jquery 获取下拉框值与select text
    js获取下拉,单选
    jquery插件
    加密
    plsql 只能识别32位的oracle解决办法
  • 原文地址:https://www.cnblogs.com/GumpYan/p/14870287.html
Copyright © 2011-2022 走看看