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

vue-m-table

v1.0.2

Published

A table component for vue.

Downloads

6

Readme

Table

Vue 的数据表格组件

功能用法与 ElTable 相似。

Live Demo

install

npm install -S vue-m-table
import MTable from 'vue-m-table'

Vue.use(MTable) // 注册 m-table, m-table-column 组件

template

<template>
  <div style="width: 800px; margin: 100px auto">
    <m-table :data="data" stripe border :row-class="rowCalss" max-height="400" head-height="35" title="数据表格">
      <m-table-column index label="编号" min-width="40px"></m-table-column>
      <m-table-column prop="name" label="名字" align="center" width="250"></m-table-column>
      <m-table-column prop="age" label="年龄" align="center"></m-table-column>
      <m-table-column prop="login" label="username"></m-table-column>
      <m-table-column label="操作" class-name="td-test" label-class-name="th-test">
        <template slot-scope="scope">
          <a href="#">{{scope.row.login}}</a>
        </template>
      </m-table-column>
    </m-table>
  </div>

</template>

<script>
export default {
  name: 'App',
  data () {
    return {
      data: [
        {name: '张三', age: 19, login: 'zhangsan'},
        {name: '李四', age: 18, login: 'lisi'},
        {name: '王五', age: 20, login: 'wangwu'},
        {name: '测试员', age: 21, login: 'ceshi'},
      ]
    }
  },
  methods: {
    rowHover (row) {
      console.log(row)
    },
    rowCalss (row) {
      return ['test']
    }
  }
}
</script>

MTable Attributes

| 参数 | 说明 | 类型 | 可选值 | 默认值 | |---------- |-------- |---------- |------------- |-------- | | title | 标题 | String | — | — | | data | 数据 | Array | — | — | | stripe | 斑马线 | Boolean | — | false | | border | 边框 | Boolean | — | false | | row-class | 行类名 | String\Function | — | — | | height | 高度 | String\Number | — | — | | max-height | 最大高度 | String\Number | — | — | | width | 宽 | String\Number | — | — | | max-width | 最大宽 | String\Number | — | — | | head-height | 表头高度 | String\Number | — | 17 | | scroll-width | 滚动条宽度 | String\Number | — | — | | void-text | 空时显示文字 | String\Number | — | 暂无数据 |

MTable Events

| 参数 | 说明 | 参数 | 可选值 | |---------- |-------- |---------- |--------- | | row-click | 行被点击 | {event, row, index} | — | | row-hover | 鼠标经过行 | {event, row, index} | — |

MTable-column Attributes

| 参数 | 说明 | 类型 | 可选值 | 默认值 | |---------- |-------- |---------- |------------- |-------- | | prop | 列显示的字段 | string | — | — | | label | 表头显示名字 | string | — | — | | align | 列对齐 | string | center,left,right | left | | index | 序号列 | Boolean | true/false | false | | minWidth | 列可缩小最小宽度 | string|number | — | 80px | | className | 列td类名 | String, Function | — | — | | labelClassName | 列th类名 | String, Function | — | — | | width | 列宽 | String\Number | — | — | | show | 是否显示列 | Boolean | true/false | true |

MTable Solt

| 参数 | 说明 | |---------- |-------- | | title | 标题部分|

Other

实现参考了 ElTable