1.0.33 • Published 1 month ago

vue-stable v1.0.33

Weekly downloads
-
License
ISC
Repository
github
Last release
1 month ago

Vue Stable

用vue2实现的一个简洁清新的移动端表格。(A simple and fresh mobile form implemented with Vue.)

插件安装(Installation)

包管理工具安装

pnpm install vue-stable

# or

npm install vue-stable

或者直接拷贝 根目录/vue-stable/vue-stable.umd.min.js 文件到你的目录,然后再引入

<script src="xxx/vue-stable.umd.min.js"></script>

使用(Usage)

  • 在项目的入口文件加入一下代码
// 导入 VueStable 组件
import VueStable from "vue-stable"
// 使用 组件
Vue.use(VueStable);
  • 在业务代码中使用,添加以下代码
<template>
  <vue-stable
    :data="tableData"
    :cols="cols"
    :cellStyle="cellStyle"
    :headerCellStyle="headerCellStyle"
    @click-cell="handleClickCell"
    :loading="loading"
    :finished="finished"
  >
  </vue-stable>
</template>

<script>
export default {
  name: "App",
  data() {
    return {
      tableData: [
        {
          name: "andy",
          age: 18,
          sex: "man",
          job: "Front-end engineer啥地方撒",
        },
        {
          name: "小妖精",
          age: 100,
          sex: "woman",
          job: "妖怪",
        },
        {
          name: "光头强",
          age: 36,
          sex: "man",
          job: "伐木工",
        },
      ],
      cols: [
        { field: "name", title: "姓名", width: "25%" },
        { field: "age", title: "年龄", width: "25%" },
        { field: "sex", title: "性别", width: "25%" },
        { field: "job", title: "职业", width: "25%" },
      ],
      cellStyle: { color: "#3D404D", "font-size": "14px" },
      headerCellStyle: {
        color: "#696893",
        "font-size": "12px",
      },
      loading: false,
      finished: false,
    };
  },
  methods: {
    handleClickCell(value, col, colIndex, rowIndex) {
      console.log(value, col, colIndex, rowIndex);
    },
  },
};
</script>

参数说明(Documentation)

  • 属性 (Props)
属性名(Name)说明(Description)类型(Type)默认值(Default)
* data(必填)表格里面的数据Array-
* cols(必填)列的配置值Object {field: 列数据在数据项中对应的字段title:列头显示文字width:列宽度}-
cellStyle表格行单元格样式Object{}
headerCellStyle表头样式Object{}
* loading(必填)是否加载数据中Boolean-
* finished(必填)是否数据加载完成Boolean-
  • 事件(Event)
事件名说明回调参数
click-cell点击单元格时触发{ value, col, colIndex, rowIndex }

写在最后

如果此项目对你有帮助,或者给你带来了灵感欢迎来github Star,您的支持就是我的动力!😘谢谢!!!

1.0.33

1 month ago

1.0.23

12 months ago

1.0.22

12 months ago

1.0.21

12 months ago

1.0.20

12 months ago

1.0.19

12 months ago

1.0.18

12 months ago

1.0.17

12 months ago

1.0.16

12 months ago

1.0.15

12 months ago

1.0.14

12 months ago

1.0.13

12 months ago

1.0.11

12 months ago

1.0.10

12 months ago

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago