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-ex-eltable

v1.0.1

Published

结合 element-ui form + pagination,表格渲染自带分页功能,可控制是否开启该功能,并整合了前端业务代码示例

Downloads

10

Readme

写在前面

感谢本程序主要代码来源 Rudolph的博客

vue-ex-eltable

结合 element-ui form + pagination,表格渲染自带分页功能,可控制是否开启该功能,并整合了前端业务代码示例。

Demo

https://cmqiong.github.io/vue-ex-eltable/example/index.html

Notices

使用条件:

  • 使用 elementUI

Installation

npm i vue-ex-eltable

Usage

详细代码参见 example/src/APP.vue

.vue

<template>
  <div class="app-container">
    <ex-table
      ref="table1"
      v-loading="listLoading"
      element-loading-text="加载中,请稍后..."
      :data="data"
      :search-method="fetchRemoteData"
      :page-size="3"
      :page-sizes="[3, 5, 10]">
      <el-table-column label="ID" prop="id"/>
    </ex-table>
  </div>
</template>
<script>
import ExTable from './vue-ex-eltable/index.js'

export default {
    components: {ExTable},
    data() {
      return {
        listLoading: false,
        lastSearchParameters: {},
        data: []
      }
    },
    methods: {
      // 在此操作对查询参数进行转换
      updateLastSearchParams() {
        this.handleSearchParams('state', this.status)
      },
      // 如果该查询参数为空字符串或无,则删掉该参数
      handleSearchParams(queryParamName, sourceParam) {
        if (!sourceParam.length) {
          delete(this.lastSearchParameters[queryParamName])
        } else {
          this.lastSearchParameters[queryParamName] = sourceParam
        }
      },
      // 防止不同接口分页参数不同
      updateLastSearchPages(currentPage, pageSize) {
        // 此处对请求页码参数进行转换
        currentPage && (this.lastSearchParameters.page = currentPage)
        pageSize && (this.lastSearchParameters.per_page = pageSize)
      },
      // 数据获取渲染
      fetchRemoteData(currentPage, pageSize) {
        if (this.listLoading) return

        this.listLoading = true
        this.updateLastSearchPages(currentPage, pageSize)
        console.log('lastSearchParameters', this.lastSearchParameters)

        // 获取数据操作...
        this.data = []
      },
      submitSearch() {
        this.updateLastSearchParams()
        this.fetchRemoteData(1)
      }
    },
    mounted() {
      this.$refs.table1.fetchData()
    }
  }
</script>

Attribute

| 参数 | 说明 | 类型 | 可选值 | 默认值 | | -------- | ------------- | ----------- | --------------- | --------- | | searchMethod | 必选参数,获取数据的操作 | Function | - | ()=>{} | | show-pagination | 可选参数,是否显示分页组件 | Boolean | true、false | true | | pagination-layout | 可选参数,组件布局,子组件名用逗号分隔 | String | - | total, sizes, prev, pager, next, jumper | | page-size | 可选参数,每页显示条目个数 | Number | - | 10 | | page-sizes | 可选参数,每页显示个数选择器的选项设置 | Number[] | - | [10, 25, 50, 100] |