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

wh-table-group

v0.0.1-d

Published

A Vue.js project

Downloads

2

Readme

my-table

A Vue.js project

Preview

# clone
git clone [email protected]:stack-wuh/my-table.git

cd example

npm install

npm run dev

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

For detailed explanation on how things work, consult the docs for vue-loader.

使用

WTable

Props

| 参数 | 说明 | 类型 | 默认值 | | :-- | :-- | :-- | :-- | | header | 是否展示Table的header部分 | Boolean | true | | footer | 是否展示Table的Footer部分 | Boolean | true | | columns | 提供迭代的TableColumn的列表 | Array | [] | | data | Table的元数据 | Array | [] | | border | 是否展示Table的边框 | Boolean | true | | stripe | 是否Table的斑马纹 | Boolean | true | | isShowPrefix | 是否展示表格第一列的功能列 | Boolean | true | | textAlign | 对齐的位置 | String | center |

Events

按钮点击或者其他事件全部由v-on代理了, 使用了MySearchButtonGroup组件, 具体上传的事件名全部通过ref属性自定义, 使用方法如下:

import WTable from 'wh-table'
Vue.use(WTable)

const btns = [
  {
    text: 'down',
    ref: 'down'
  },
  {
    text: 'search',
    ref: 'search'
  },
  {
    text: 'any',
    ref: 'any'
  }
]
  <w-table
    @down="handleDown"
    @search="handleSearch"
    @any="handleAny">
  </w-table>

Slot

| name | 说明 | | :-- | :-- | | header | 表格Header区域 | | footer | 表格的footer区域 |

WTabelHeader

Props

| 参数 | 说明 | 类型 | 默认值 | | :-- | :-- | :-- | :-- | | name | 表格左上角的文本 | String | none |

Slot

| name | 说明 | | :-- | :-- | | right | 为表格Header区域预留了功能区域, 可以在这里添加按钮或者是表单, 推荐搭配MySearchGroup组件使用 |

WTableColumn

由自定义JSON文件迭代渲染, 使用如下:

const List = [
  {
    label: '姓名',
    field: 'name',
    type: ['default', undefined, null], // 以上三种情况可以不填
  },
  {
    label: 'XXX',
    field: 'custom',
    type: 'image'
  },
  {
    label: 'XXX',
    field: 'custom',
    type: 'switch',
  },
  {
    label: 'XXX',
    field: 'custom',
    type: 'tag',
    transfer: {
      value1: mapValue1,
      value2: mapValue2
    },
    types: {
      value1: 'success',
      value2: 'info'
    }
  },
  {
    label: 'XXX',
    field: 'custom',
    type: 'component',
    component: VueComponent
  },
  {
    label: 'XXX',
    type: 'button',
    list: [
      {
        text: 'up',
        ref: 'up'
      },
      {
        text: 'down',
        ref: 'download'
      }
    ]
  }
]

type == [default, null, undefined]

| 参数 | 说明 | | :-- | :-- | | default | 只能渲染普通文本 |

type == image[, images]

| 参数 | 说明 | | :-- | :-- | | image | 只能渲染一张图片, 如: { url: 'https:www.baidu.com' } | | images | 可以渲染多张图片, 期待后台返回一个数组, 如: { url: ['/image1.png', '/imgs2.png'] } |

type == switch

| 参数 | 说明 | | :-- | :-- | | switch | 使用element的Switch组件, 一个双向开关, 属性同element |

type == tag

| 参数 | 说明 | | :-- | :-- | | tag | 用于多状态枚举, 后台返回值需要前端映射, 提供一个transfer对象用于渲染, types对象用于绑定展示type |

type == component

| 参数 | 说明 | | :-- | :-- | | component | 使用Vue中的Component标签, 自定义满足需求的组件, 组件声明如下 |

const VueComponent = {
  props: ['scope'],
  template: `
    <div class="wrap">{{scope}}</div>
  `
}
const List = [
  {
    label: 'aaa',
    type: 'component',
    component: VueComponent
  }
]
  <component :is="List.component" v-bind="List" :scope="List"></component>

type == button

搭配MySearchButtonGroup 使用