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

el-normaltable-vue3

v1.3.6

Published

基于elementPlus二次封装

Downloads

22

Readme

动态table

配置

| props | 类型 | Description | | --- | --- | | [filter] | function,Array | data配置项 | | [columns] | Array | data配置项 | | [onSearch] | Function | data配置项 | | [pagination] | Boolean,Object | Boolean显示隐藏,Object可配置对应参数传入 |

  • 动态table用法
<NormalTable
  :filter="tableData.filter"
  :columns="columns"
  :onSearch="tableData.onSearch"
  :pagination="pagination"
></NormalTable>
<el-table :data="data1">
  <NormalColumns :columns="columns">
  </NormalColumns>
</el-table>
export default {
  name: 'App',
  data() {
    return {
      tables: {
        isShowFilterLabel: false, // filter中始终显示label
        filter: [
          {
            tag: 'Select',  // 驼峰方式
            label: '状态',
            prop: 'status',
            bind: { // 可传入element任意属性
              options: this.getList // 可为数组或函数,可同步可异步
              defaultValue: 1 // 初始化参数
            }
          },
          {
            tag: 'Select',
            label: '状态1',
            prop: 'statu1s',
            bind: {
              options: [{ value: 1, label: '同步方式'}] // 同步方式返回
            }
          },
          {
            tag: 'Checkbox',
            label: '状态',
            prop: 'status',
            bind: {
                options: [{ value: 1, label: '同步方式'}] // 同步方式返回
            }
          },
          {
            tag: 'DatePicker',
            label: '测试稍等稍等都是开始日期:',
            prop: 'time',
            bind: { // 可传入element任意属性
              type: 'datetimerange',
              // valueFormat: 'yyyy-MM-dd: HH-mm-ss' // value格式
              startPlaceholder:"空档开1始日期",
              endPlaceholder: "空档结111束日期",
              // defaultValue: [new Date('2022-07-10'), new Date('2022-07-20')] // 默认值
            }
          },
        ],
        operations: [{
          label: '测试123',
          type: 'success',
          call: () => {
            // 点击后执行call
          },
          bind: { // 非必须,可传入element任意属性
            circle: true,
            icon: 'el-icon-search'
          }
        }],
        columns: [
          {
            type: 'selection'
          },
          {
            prop: 'snowId',
            label: 'ID',
            render: (h, row) => { // 需计算或文字不满足可利用render, 第一个参数为h函数,第二个参数为当前行数据
              const onchange = (value) => {
                this.value = value
              }
              return (<div>
                <el-input value={this.value} onInput={onchange} placeholder="请输入内容"></el-input>
              </div>)
            }
          },
          {
            prop: 'ddd',
            label: '测12222试',
            width: '140px',
            render: (row) => {
              return row.snowId === 1 ? '测试1' : '测试2'
            }
          },
          {
            prop: 'img',
            label: '测12222试',
            type: 'Img'
          },
          {
            label: '操作',
            btns: (row) => { // 可为数组可为函数
              const isShowAdd = row.id !== 1
              return [
                {
                  label: '确认',
                  call:(row) => {} // row参数为当前行数据
                },
                {
                  label: '添加',
                  hide: isShowAdd, // 是否隐藏该button
                  // type: 'text',
                  // confirm: '确定移除吗?', // 二次确认弹窗
                  call: (row) => {
                    row = JSON.parse(JSON.stringify(row))
                  }
                }
              ]
            }
          }
        ],
        onSearch: async({ filterValue, pagination }) => {
          // filterValue为选中参数,pagination为分页数据
          return {
            ...pagination,
            page: 1,
            total: 1000,
            pageSize: 100,
            list: []
          }
        }
      }
    }
  },
  methods: {
    getList() {
      // 异步方式
      return new Promise((resolve, reject) => {
        setTimeout(() => {
          resolve([{value: 1, label: '张三'}] )
        }, 1000);
      })
    }
  }
}

tag配置:{
    'Input': 'el-input',
    'Select': 'NormalSelect',
    'DatePicker': 'NormalPicker',
    'Upload': 'NormalUpload',
    'Date': 'NormalDate',
    'Cascader': 'el-cascader',
    'Radio': 'NormalRadio',
    'InputNumber':'el-input-number',
    'Switch': 'el-switch',
    'Checkbox': 'NormalCheckbox'
}

动态表单

  • 动态表单用法
<NormalForm ref="NormalForm" :normalForm="normalForm" />

normalForm: {
  dialogBind: {
    width: '600px',
  },
  list: (data) => {
    // const isStatusShow = data.id === 1
    return [
      {
        label: '状态',
        // hide: isStatusShow,
        prop: 'status',
        render(row) {
          return '文字展示'
        }
      },
      {
        tag: 'Input',
        label: '跟进信息',
        prop: 'content',
        bind: { // 非必须,可传入input支持属性
          input: (val) => {
            console.log(val)
          }
        }
      },
      {
        tag: 'Upload',
        label: '跟进信息',
        prop: 'img',
        bind: {
          action: 'https://jsonplaceholder.typicode.com/posts/'
        }
      },
    ]
  },
  async submit (values) {
    console.log(values, '点击确认执行')
  }
}