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

sf-table

v0.1.0

Published

sf-table component for SailFish

Downloads

1

Readme

七鱼表单组件

用于展示多条结构类似的数据, 打包文件自动安装了 sf-table, sf-table-column 组件

基本用法

:::ysfdoc 当sf-table元素中注入data对象数组后,在sf-table-column中用prop属性来对应对象中的键名即可填入数据,用label属性来定义表格的列名。可以使用width属性来定义列宽(不设置则自适应)。

  <template>
    <sf-table
      :data="tableData"
     >
      <sf-table-column
          prop="name"
          label="姓名"
          width="180">
        </sf-table-column>
      <sf-table-column
        prop="age"
        label="年龄"
        >
      </sf-table-column>
      <sf-table-column
        prop="sex"
        label="性别">
      </sf-table-column>
    </sf-table>
  </template>

  <script>
    export default {
      data() {
        return {
          tableData: [{
            name: 'tom',
            age : '10',
            sex : 'male'
          }, {
            name: 'vina',
            age: '11',
            sex: 'female'
          }, {
            name: 'lucy',
            age: '12',
            sex: 'female'
          }, {
            name: 'joy',
            age: '13',
            sex: 'male'
          }]
        }
      }
    }
  </script>

:::

带斑马纹表格和边框表格

:::ysfdoc 设置不同的表格表现形式

  <template>
    <sf-table
      :data="tableData" stripe border
     >
      <sf-table-column
          prop="name"
          label="姓名"
          width="180">
        </sf-table-column>
      <sf-table-column
        prop="age"
        label="年龄"
        >
      </sf-table-column>
      <sf-table-column
        prop="sex"
        label="性别">
      </sf-table-column>
    </sf-table>
  </template>

  <script>
    export default {
      data() {
        return {
          tableData: [{
            name: 'tom',
            age : '10',
            sex : 'male'
          }, {
            name: 'vina',
            age: '11',
            sex: 'female'
          }, {
            name: 'lucy',
            age: '12',
            sex: 'female'
          }, {
            name: 'joy',
            age: '13',
            sex: 'male'
          }]
        }
      }
    }
  </script>

:::

样式自定义

:::ysfdoc 支持自定义表格样式clazz, 自定义表格高度height, 表头高度header-height

  <template>
    <sf-table
      :data="tableData" header-height="100" height="300" clazz="sf-table-custom"
     >
      <sf-table-column
          prop="name"
          label="姓名"
          width="180">
        </sf-table-column>
      <sf-table-column
        prop="age"
        label="年龄"
        >
      </sf-table-column>
      <sf-table-column
        prop="sex"
        label="性别">
      </sf-table-column>
    </sf-table>
  </template>

  <script>
    export default {
      data() {
        return {
          tableData: [{
                name: 'tom',
                age : '10',
                sex : 'male'
            }, {
                name: 'vina',
                age: '11',
                sex: 'female'
            }, {
                name: 'lucy',
                age: '12',
                sex: 'female'
            }, {
                name: 'joy',
                age: '13',
                sex: 'male'
            }, {
                name: 'joy',
                age: '13',
                sex: 'male'
            }, {
                name: 'joy',
                age: '13',
                sex: 'male'
            }]
        }
      }
    }
  </script>

:::

表格排序功能及自定义事件

:::ysfdoc 表格支持排序功能sortable, 先支持行选中的自定义事件row-click, 列表格式化 fomatter

  <template>
    <sf-table
      :data="tableData" @row-click="rowClick"
     >
      <sf-table-column
          prop="name"
          label="姓名"
          width="180">
        </sf-table-column>
      <sf-table-column
        prop="age"
        label="年龄"
        sortable
        :sort-method="sortMethod"
        :formatter="formatter"
        >
      </sf-table-column>
      <sf-table-column
        prop="sex"
        label="性别">
      </sf-table-column>
    </sf-table>
  </template>

  <script>
    export default {
      data() {
        return {
          tableData: [{
            name: 'tom',
            age : '10',
            sex : 'male'
          }, {
            name: 'vina',
            age: '11',
            sex: 'female'
          }, {
            name: 'lucy',
            age: '12',
            sex: 'female'
          }, {
            name: 'joy',
            age: '13',
            sex: 'male'
          }]
        }
      },
      methods : {
            sortMethod : function(a, b){
                return a - b;
            },
            formatter : function(row, column){
                return row.age + 'year';
            },
            rowClick : function(row, column, event){
                return row
            }

        }
    }
  </script>

:::