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

futuret-ui

v1.0.1

Published

一个基于 vue 的 PC 端 ui 组件库 未来化,不常规的 Vue3UI 组件(包括但不限于表格、表单、弹窗、按钮等等)

Downloads

20

Readme

Futuret-ui

Futuret-ui

一个基于 vue 的 PC 端 ui 组件库 未来化,不常规的 Vue3UI 组件(包括但不限于表格、表单、弹窗、按钮等等)

功能点

  • 特色表格
  • 弹窗
  • 多样按钮
  • 表单
  • ...

浏览器支持

| Edge | Chrome | Firefox | Opera | Safari | | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | | 80+ ✔ | 80+ ✔ | 90+ ✔ | 75+ ✔ | 10+ ✔ |

安装

版本:vue 3.x

npm install futuret-ui -d

NPM

只使用表格

表格超过 50 行就会触发虚拟化表格支持十万行渲染

// ...
import futuretui from "futuret-ui";
import "futuret-ui/es/style.css";
// ...

createApp(App).use(futuretui).mount("#app");

示例

<template>
  <div>
    <future-tableTroor ref="xToolbar">
      <template v-slot:buttons>
        <button>提示(10000条数据)</button>
      </template>
      <template v-slot:tools>
        <button>提示(10000条数据)</button>
      </template>
    </future-tableTroor>
    <future-table
      ref="xTable1"
      :data="data"
      :options="options"
      :rowCofig="{
      highlight: false
    }"
      ids="id"
      height="70vh"
    >
      <template v-slot:caozuo>
        <button>编辑</button>
        <button>添加</button>
      </template>
    </future-table>
  </div>
</template>

<script lang="ts" setup>
  import { ref, nextTick, onMounted, provide } from "vue";
  const xTable1: Ref<any | null | undefined> = ref();
  const xToolbar: Ref<any | null | undefined> = ref();
  nextTick(() => {
    setTimeout(() => {
      // 将表格和工具栏进行关联
      const $table = xTable1.value;
      const $toolbar = xToolbar.value;
      $table.connect($toolbar);
    }, 0);
  });
  const options: any = {
    column: [
      {
        prop: "id",
        title: "Id",
      },
      {
        prop: "names",
        title: "姓名",
      },
      {
        prop: "age",
        title: "年龄",
      },
      {
        prop: "sex",
        title: "性别",
      },
      {
        prop: "address",
        title: "地址",
      },
      {
        prop: "caozuo",
        title: "操作",
      },
    ],
  };
  const data = ref<any>([
    {
      id: "15",
      names: "张三",
      age: 18,
      sex: "女",
      address: "中国第一龙江市",
    },
  ]);
  onMounted(() => {
    for (let index = 0; index < 10000; index++) {
      data.value.push({
        id: index,
        names: "张三",
        age: 18,
        sex: "女",
        address: "中国第一龙江市",
      });
    }
  });
</script>

FutureTable 配置项

| 属性 | 说明 | 类型 | 可选值 | 默认值 | | --------- | :----------------------------------------------- | ----------------- | ------------- | ---------- | | data | 显示的数据 | Array | [ ] | [ ] | | options | 列配置 | 对象 OptionObject | OptionObject | 配置看下面 | | rowCofig | 表格配置 | 对象 | - | - | | ids | 表格配置 highlight 为 true 的时候,选中的 key 值 | string | - | - | | height | 表格高度 | string | px/vw/vh/em/% | - | | minheight | 表格最小高度 | string | px/vw/vh/em/% | - | | maxheight | 表格最大高度 | string | px/vw/vh/em/% | - |

FutureTable OptionObject 配置项

| 属性 | 说明 | 类型 | 可选值 | 默认值 | | ------ | :--------- | ----- | ------ | ------ | | column | 展示列数据 | array | column | [ ] |

column

| 属性 | 说明 | 类型 | 可选值 | 默认值 | | ----- | :----------------- | ------ | ------------- | ------ | | prop | 对应列内容的字段名 | string | - | - | | title | 显示的标题 | string | - | - | | width | 列宽 | string | px/vw/vh/em/% | - | | style | 表头和表格的样式 | string | - | - |

rowCofig

| 属性 | 说明 | 类型 | 可选值 | 默认值 | | --------- | :-------------------------------------- | ------ | ------ | ------ | | highlight | 选中列的时候有高亮 | boolen | - | false | | isChecked | 多选框可通过 ref 获取里面的 checkstr 值 | bool | - | false |

isChecked 用法

<future-table
  ref="xTable1"
  :data="data"
  :options="options"
  :rowCofig="{
      isChecked: true
    }"
  ids="id"
  height="70vh"
>
  <template v-slot:caozuo>
    <button>编辑</button>
    <button>添加</button>
  </template>
</future-table>
<script lang="ts" setup>
  import { ref, nextTick, onMounted } from "vue";
  const xTable1: Ref<any | null | undefined> = ref();

  nextTick(() => {
    //选中多选框之后的值
    console.log(xTable1.value.checkstr); //值为['15']
  });
  const options: any = {
    column: [
      {
        prop: "id",
        title: "Id",
      },
      {
        prop: "names",
        title: "姓名",
      },
      {
        prop: "age",
        title: "年龄",
      },
      {
        prop: "sex",
        title: "性别",
      },
      {
        prop: "address",
        title: "地址",
      },
      {
        prop: "caozuo",
        title: "操作",
      },
    ],
  };
  const data = ref<any>([
    {
      id: "15",
      names: "张三",
      age: 18,
      sex: "女",
      address: "中国第一龙江市",
    },
  ]);
</script>

FutureTable Event 事件

| 属性 | 说明 | 参数 | | ------------- | :------------------------------------------- | ------- | | handchangeAll | highlight 为 true 的时候的用户触发的点击事件 | options |

FutureTable slot 表格 如果需要对表头进行插入则加上_title

我们针对表格的操作列和姓名列进行插入按钮

<future-table
  :data="data"
  :options="options"
  :rowCofig="{
      isChecked: true
    }"
  ids="id"
  height="70vh"
>
  <template v-slot:caozuo>
    <button>编辑</button>
    <button>添加</button>
  </template>
  <!--rows是这一列的数据,indexs是索引  -->
  <template v-slot:names="{rows,indexs}"> {{rows.name}} </template>
  <!--这是对应name那一列的表头进行插槽  -->
  <template v-slot:names_title="{rows}"> {{rows.title}} </template>
</future-table>
<script lang="ts" setup>
  import { ref, nextTick, onMounted } from "vue";

  const options: any = {
    column: [
      {
        prop: "id",
        title: "Id",
      },
      {
        prop: "names",
        title: "姓名",
      },
      {
        prop: "age",
        title: "年龄",
      },
      {
        prop: "sex",
        title: "性别",
      },
      {
        prop: "address",
        title: "地址",
      },
      {
        prop: "caozuo",
        title: "操作",
      },
    ],
  };
  const data = ref<any>([
    {
      id: "15",
      names: "张三",
      age: 18,
      sex: "女",
      address: "中国第一龙江市",
    },
  ]);
</script>

...后续的功能在补充,现在可以单纯的当个表格组件使用