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

@zeesuu/searchlist

v1.0.19

Published

Searchable and selectabld table component for vue. Base on Element-ui

Downloads

1

Readme

@zeesuu/searchlist

页面级别的列表组件,包含基本的数据渲染,事件响应等.

安装:

$ npm i  @zeesuu/searchlist@latest -S

使用:

全局使用

main.js

import ZeesuuSearchList from ' @zeesuu/searchlist';

Vue.use(ZeesuuSearchList);

页面中

<template>
  <div class="dashboard-container">
    <search-list
      <!-- 列表请求地址(必选) -->
      :api-url="API.SUB_PLATFORM.LIST"
      <!-- 是否展示清空按钮(可选), 如果为true,当option长度为0时也不会展示 -->
      :show-reset-btn="true"
      <!-- 是否在reset后立马重新搜索(可选) -->
      :fetch-after-reset="false"
      <!-- 按钮文本(可选) -->
      :reset-btn-text="清空"
      :query-btn-text="清空"
      <!-- 搜索框配置(可选) -->
      :option="searchOpt"
      <!-- 搜索框每行控件数目(可选) -->
      :item-per-row="8"
      <!-- 设置table的rowkey(可选) -->
      :row-key="id"
      <!-- 设置table的页面偏移(可选),默认:0,用于起始页是0或者其他的情况 -->
      :page-offset="0"
      <!-- 设置table的数据字段名称(可选),默认: rows -->
      list-name="list"
      <!-- 设置默认翻页参数(可选) -->
      :pagination="pagination"
      <!-- 请求成功后回调(可选), 参数为返回的列表数据 -->
      :query-success="querySuccess"
      <!-- 请求之前处理函数(可选), 参数为 { searchInfo: {}}, 可以设置默认搜索参数 -->
      :before-query="beforeQuery"
      <!-- 多选数据响应(可选) -->
      @selection-change="selectionChange"
      <!-- 双击一行数据响应(可选) -->
      @table-row-dbclick="dbClicked"
      <!-- 是否立即请求数据(可选) -->
      :fetch-now="false"
    >
      <!-- 如果要多选,可以第一个列表现增加单选框(可选) -->
      <el-table-column type="selection"></el-table-column>

      <!-- 列表项 -->
      <el-table-column prop="title" width="400" label="公司名称"></el-table-column>
      <el-table-column prop="status" label="公司名称"></el-table-column>
      <el-table-column prop="author" label="作者名称"></el-table-column>
      <el-table-column prop="display_time" label="作者名称"></el-table-column>
      <el-table-column prop="pageviews" label="作者名称"></el-table-column>
      <el-table-column label="操作">
        <!-- 获取每行数据 -->
        <template slot-scope="scope">
          <el-button type="primary" size="mini">{{ scope.row.id }}</el-button>
        </template>
      </el-table-column>

      <!-- 查询按钮前的位置插槽 -->
      <div slot="btn-before" class="btn-before">
        <el-button type="success" size="mini">before</el-button>
      </div>

      <!-- 重置按钮后的位置插槽 -->
      <div slot="btn-after" class="btn-after">
        <el-button type="info" size="mini">after</el-button>
      </div>

      <!-- 按钮和表格之间的位置插槽 -->
      <div slot="tab-before" class="tab-before">
        说明文字说明文字说明文字说明文字说明文字
      </div>
    </search-list>
  </div>
</template>

<script>
  import { API } from '@/config';

  export default {
    name: 'SubManage',
    data() {
      return {
        searchOpt: [
          {
            // 控件类型字符串, 控件需要被注册
            type: this.SEARCH_COMP_ENUM.SEARCH_INPUT,
            // 搜索表单字段名
            name: 'id',
            // placeholder
            label: '平台ID',
          },
          {
            type: this.SEARCH_COMP_ENUM.SEARCH_DATEPICKER,
            name: 'time',
            label: '平台ID',
            conf: {
              type: 'daterange',
            },
          },
        ],
        pagination: {
          // 当前页面
          page: 1,
          // 每页数量
          size: 10,
          // 总页数
          total: 0,
          // 请求标志位
          loading: false,
        },
        API,
      };
    },
    methods: {
      querySuccess(list) {
        return list;
      },
      beforeQuery(val) {
        const { searchInfo } = val;
        searchInfo.id = '123';
      },
      selectionChange(selectedList) {
        console.log(selectedList);
      },
      dbClicked(dbRow) {
        console.log(dbRow);
      },
    },
  };
</script>

Dependencies

  1. this.$http

此组件依赖调用环境的 this.$http 是用于发起请求的对象实例,比如 axios.

没有的话,则无法完成远程调用.

  1. Element-ui

此组件依赖调用环境需要安装 Element-ui