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

bi-element-ui

v1.2.1

Published

基于element-ui编写的ui组件库

Downloads

726

Readme

vue-free-table

基于 element ui table 二次封装,几乎支持原 table 所有的功能

文档使用

DEMO 预览

特性

  • 以 element-ui table 为基础进行二次封装,减少代码量
  • 继承 element-ui table 组件的参数及事件
  • 支持 render 渲染
  • 支持 slot 插槽
  • 支持组件引入
  • 支持树形数据
  • 支持分页功能

文档

| 属性 | 说明 | 类型 | 默认 | | --------------- | -------------------------------------------------- | --------- | ------- | | data | table 的 data 属性 | Array | [] | | column | 用于控制表格列渲染 | Array | [] | | columns-props | 用于定义所有 column 公共的属性 | Object | | | pagination | 是否显示分页组件, 具体详细请看pagination配置栏目 | Boolean | false |

只是在 Element Table 封装了一层,原本设置在 Table 上的 props 与事件监听和设置都可以直接绑定到组件上,具体配置可参考Element Tabel 文档

column 配置 column 用于控制表格的列行为, 设置示例:

const column = [
  { label: '日期', prop: 'date', width: 100 },
  { label: '姓名', prop: 'name' },
  { label: '邮编', prop: 'zip' },
  {
    label: '地址',
    prop: 'address',
    render: (h, scope) => {
      return (<el-tag>{scope.row.address}<el-tag>)
    }
  },
  {
    label: '组件',
    prop: 'cmp',
    component: EditBtn,
    listeners: {
      'row-edit'(row) {
        console.log('row-edit', row)
      }
    }
  }
]

columns-props 配置 columns-props 用于配置 columns 各列默认的 props 属性,

const columnsProps = {
  align: 'left',
  minWidth: 120
}

pagination 配置 pagination 用于控制显示分页组件, pagination 分页组件是继承 el-pagination 的二次封装,来源开源项目中的vue-element-admin 组件库中分页组件

| 参数 | 说明 | 类型 | 默认值 | | ------------- | ------------------------------------- | ---------- | ---------------- | | total | 总条目数 | Number | / | | page | 当前页数 支持 .sync 修饰符 | Number | 1 | | limit | 每页显示条目个数,支持 .sync 修饰符 | Number | 20 | | page-sizes | 每页显示个数选择器的选项设置 | Number[] | [10, 20, 30, 50] | | hidden | 是否隐藏 | Boolean | false | | auto-scroll | 分页之后是否自动滚动到顶部 | Boolean | true |

其它 Element 的 el-pagination 支持的属性,它也都支持。详情见文档

示例

<template>
  <bi-table border stripe :data="data" :column="column"></bi-table>
</template>

<script>
import BiTable from '@/components/BiTable'

export default {
  components: {
    BiTable
  },
  data() {
    return {
      column: [
        { label: '日期', prop: 'date' },
        { label: '姓名', prop: 'name' },
        { label: '省份', prop: 'province' },
        { label: '市区', prop: 'city' },
        { label: '地址', prop: 'address' }
      ],
      data: [
        {
          date: '2016-05-03',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1518 弄'
        },
        {
          date: '2016-05-02',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1518 弄'
        }
      ]
    }
  }
}
</script>

构建命令

# 安装依赖包
npm install

# 启动开发环境
npm run serve

# 构建生产环境
npm run build

# 启动unit测试
npm run test:unit

# 启动unit end-to-end 测试
npm run test:e2e

# 检查修复代码
npm run lint