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

iview-edit-table

v1.0.0

Published

基于 iview 组件库开发的可编辑表格

Downloads

4

Readme

iview-edit-table

概述

iview-edit-table是基于iview组件库开发的可编辑表格,使用灵活的JSON配置去渲染组件,支持行操作。需要注意的是,iview-edit-table必须在安装了iview的基础上再安装使用。

安装

npm install iview-edit-table --save

使用

<template>
  <div id="app">
    <edit-table
      show-index-column
      v-model="data"
      :columns="columns"
      :actions="actions"
      @on-change="handleChange"
    >
    </edit-table>
  </div>
</template>

<script>
import EditTable from 'iview-edit-table'

export default {
  name: 'app',
  components: { EditTable },
  data() {
    return {
      data: [
        {
          name: 'John Brown',
          age: 18,
          gender: 1,
          marry: false,
          address: 'New York No. 1 Lake Park',
          date: '2016-10-03',
          hobby: [1, 2],
          person: []

        },
        {
          name: 'Jim Green',
          age: 24,
          gender: 1,
          marry: false,
          address: 'London No. 1 Lake Park',
          date: '2016-10-01',
          hobby: [1],
          person: []
        },
        {
          name: 'Joe Black',
          age: 30,
          gender: 1,
          marry: true,
          address: 'Sydney No. 1 Lake Park',
          date: '2016-10-02',
          hobby: [1, 3],
          person: []
        },
        {
          name: 'Jon Snow',
          age: 26,
          gender: 0,
          marry: true,
          address: 'Ottawa No. 2 Lake Park',
          date: '2016-10-04',
          hobby: [2, 3],
          person: []
        },
      ],
      columns: [
        {
          title: '基本信息',
          children: [
            {
              key: 'name',
              title: '姓名',
              width: 140,
            },
            {
              key: 'age',
              title: '年龄',
              width: 120,
              type: 'number',
            },
            {
              key: 'gender',
              title: '性别',
              type: 'select',
              width: 120,
              options: [{
                fdValue: 1, fdLabel: '男',
              }, {
                fdValue: 0, fdLabel: '女',
              }],
              props: { value: 'fdValue', label: 'fdLabel' },
            },
          ],
        },
        {
          key: 'marry',
          title: '是否已婚',
          width: 100,
          type: 'checkbox',
        },
        {
          key: 'address',
          title: '地址',
          type: 'input',
          minWidth: 200,
        },
        {
          key: 'date',
          title: '日期',
          width: 160,
          type: 'datePicker',
        },
        {
          key: 'hobby',
          title: '爱好',
          width: 300,
          type: 'checkboxGroup',
          options: [
            { label: '游泳', value: 1 },
            { label: '跑步', value: 2 },
            { label: '写代码', value: 3 },
          ],
        }
      ],
      actions: [
        {
          text: '详情',
          type: 'primary',
          onClick: row => {
            /* eslint-disable no-console */
            console.log(row)
          }
        },
        {
          text: '修改',
          type: 'primary',
          disabled: row => row.age > 24,
          onClick: row => {
            /* eslint-disable no-console */
            console.log(row)
          }
        },
        {
          text: '删除',
          type: 'warning',
          confirm: {
            title: '确认删除吗?',
          },
          disabled: row => row.age > 24,
          onClick: row => {
            /* eslint-disable no-console */
            console.log(row)
          }
        },
      ],
    }
  },
  methods: {
    handleChange(val) {
      /* eslint-disable no-console */
      console.log(val)
    }
  }
}
</script>

说明

iview-edit-table内置支持的组件有InputInputNumberSelectDatePickerTimePickerCheckboxCheckboxGroup,如有需要支持更多的组件,可联系作者,希望提出组件优化方向的建议。

联系

如有疑问,请联系邮件:[email protected]