npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-table-pagination

v1.1.3

Published

vue-table-pagination using Jest + vue-test-utils together test webpack3 vue2.

Downloads

70

Readme

vue-table-pagination

vue2封装的table联动组件

NPM

npm version Build Status Coverage Status npm Download gzip tested with jest

Live Demo

vue-table-pagination-demo Site

Install with npm

Installing

npm install --save vue-table-pagination

Import

import Vue from 'vue';
import VueTablePagination from 'vue-table-pagination';
Vue.use(VueTablePagination);

西门互联分页组件

可自定义配置和分页可fork自行修改

<vue-table-pagination
                    @gmChangePageButton="gmChangePageButton"
                    @gmChagePageSize="gmChagePageSize"
                    :gmCurrentPage="page"
                    :gmTotalPage="totalPage"
                    :gmCanJump="true"
                    :gmCanChoose="true"
                    :gmTableLists="gmTableLists"
                    :gmTableThLists="gmTableThLists"
                    :gmIsIndex="true"
                    @gmPerEmitClick="gmPerEmitClick"
                    :gmTableWidth="0"
                    :gmTimeStampType="63"
            ></vue-table-pagination>
gmChangePageButton -- 按钮改变分页
gmChagePageSize --每页显示多少条
page -- 当前高亮锚点
totalPage -- 总页数
gmCanJump --是否跳转
gmCanChoose -- 是否改变分页条数
gmTableLists --tbody数据
gmTableThLists --theader数据
gmIsIndex --开启索引
gmPerEmitClick --table中的按钮操作
gmTableWidth --table宽度
gmTimeStampType --时间参数

效果图截图

vue2封装的table联动组件 vue2封装的table联动组件配色

演示test.vue

<template>

    <div class="page-view">
        <div class="page-content">
          <!-- 通用table组件 -->
          <!--用法 -->
          <vue-table-pagination
                  @gmChangePageButton="gmChangePageButton"
                  @gmChagePageSize="gmChagePageSize"
                  :gmCurrentPage="page"
                  :gmTotalPage="totalPage"
                  :gmCanJump="true"
                  :gmCanChoose="true"
                  :gmTableLists="gmTableLists"
                  :gmTableThLists="gmTableThLists"
                  :gmIsIndex="true"
                  @gmPerEmitClick="gmPerEmitClick"
                  :gmTableWidth="0"
                  :gmTimeStampType="63"
          ></vue-table-pagination>
        </div>
      </div>

</template>

<script>

  export default {
    name: 'test',
    data(){
      return {
          page:1,
          pageSize:10,
          totalPage:100,
          //修改为value对象下面值取
          gmTableLists:[
              {
                "game_uuid": {
                  "value": 14
                },
                "title": {
                  "value": "标题1"
                },
                "content": {
                  "value": "这是标题1的所有内容内容这是标题1的所有内容内容"
                },
                "attachment": {
                  "value": [
                    {
                      "props": "晶能id",
                      "number": "10"
                    }, {
                      "props": "皮肤id",
                      "number": "10"
                    }
                  ]
                },
                "receiver": {
                  "value": ["张三", "李四", "王麻子", "小红"]
                },
                "sendtime": {
                  "value": 1515772800
                },
                "create_user": {
                  "value": "超级管理员1"
                },
                "create_time": {
                  "value": 1515828493
                },
                "update_user": {
                  "value": "admin"
                },
                "update_time": {
                  "value": '1515828493'
                },
                "operate": {
                  "value": [
                    {
                      "game_uuid": 14,
                      "action": "pk_id"
                    }, {
                      "button_name": "编辑",
                      "action": "edit"
                    }, {
                      "button_name": "删除",
                      "action": "delte"
                    }
                  ]
                }
              },
              {
                "game_uuid": {
                  "value": 15
                },
                "title": {
                  "value": "标题2"
                },
                "content": {
                  "value": "这是标题2的所有内容内容这是标题1的所有内容内容"
                },
                "attachment": {
                  "value": [{
                    "props": "晶能id",
                    "number": "11"
                  }, {
                    "props": "皮肤id",
                    "number": "12"
                  }]
                },
                "receiver": {
                  "value": ["小米", "小明"]
                },
                "sendtime": {
                  "value": 1515772800
                },
                "create_user": {
                  "value": "超级管理员2"
                },
                "create_time": {
                  "value": 1515828093
                },
                "update_user": {
                  "value": "jackieli"
                },
                "update_time": {
                  "value": ''
                },
                "operate": {
                  "value": [
                    {
                      "game_uuid": 15,
                      "action": "pk_id"
                    }, {
                      "button_name": "编辑",
                      "action": "edit"
                    }, {
                      "button_name": "删除",
                      "action": "delte"
                    }
                  ]
                }
              }
          ],
          //接口先获取这个表头字段对应    "fields"://表单字段列表  button 操作
          //然后在获取gmTableLists
          //每个用户看到的字段格式都不一样(权限可设置)
          gmTableThLists:{
              "game_uuid":"流水号",
              "title":"标题",
              "content":"内容预览",
              "attachment":"邮件奖励",
              "receiver":"收件人/人数",
              "sendtime":"发送时间",
              "create_user":"创建者",
              "create_time":"创建时间",
              "update_user":"审核人",
              "update_time":"审核时间"
          }
      }
    },
    methods: {
      //循环事件派发
      gmPerEmitClick(list,index,type){
        console.log("格式化后的当前列数据",list);
        let game_uuid = list.game_uuid.value
        //通过this.gmTableLists[index]的数据来判断每列操作的button的事件
        console.log("通过index参数获取原始数据的操作当前列",this.gmTableLists[index])
        // console.log("商品id:"+id+"---事件:"+type)
        console.log("流水号:"+game_uuid+"---对外index:"+index+"--对外事件类型"+type)
        //this.$router.replace('/')
      },
      gmChagePageSize(data){
        this.page = 1
        this.pageSize = data
        console.log(data)
      },
      //分页组件传递事件ajax
      gmChangePageButton(page){
         this.page = page
         console.log(page)
      }
    }
  };
</script>

<style lang="css">
  #app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  color: #2c3e50;
}

* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}


* > input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px #fff inset !important; /*关于解决输入框背景颜色*/
    -webkit-text-fill-color: #000000!important;
}
html,
body {
    font-family: "Microsoft YaHei";
    font-size: 14px;
    color: rgba(0, 0, 0, 0.85);
    background: #fff;
    padding: 0 10px;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

ol,
ul,
li {
    list-style: none;
}

img {
    border: 0 none;
}

a {
    text-decoration: none;
}

a,
input,
textarea {
    outline: none;
}

input::-ms-clear,
input::-ms-reveal {
    display: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

caption,
th,
td {
    text-align: left;
    font-weight: normal;
    vertical-align: middle;
}

.clearfix {
    *zoom: 1;
}

.clearfix:after {
    clear: both;
    content: '';
    display: block;
    height: 0;
    visibility: hidden;
}

.hide {
    display: none !important;
}

.show {
    display: block;
}

.fl {
    float: left;
}

.fr {
    float: right
}
</style>