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

uniqueway-element

v1.1.0

Published

基于 element-ui 库的二次封装,该组件库主要针对现有列表页的 table 表格及 form 表单中的 rules 校验等场景,旨在减少重复的操作,让开发变得更简单。

Downloads

30

Readme

Install

npm install uniqueway-element

Quick Start

import Vue from 'vue'
import UniquewayElement from 'uniqueway-element'

Vue.use(UniquewayElement)

Components

// 名字太长,待优化
UniquewayElementTableList - 可配置的 Table
UniquewayElementScrollAffix - 固钉
UniquewayElementPreviewUploadSingle - 单张图片上传
UniquewayElementPreviewUploadMultiple - 多张个图片上传

Mixin

RulesForm - Form 表单规则

Using

  • 示例 UniquewayElementTableList
<template>
  <UniquewayElementTableList
    title="产品列表"
    :paginationFilter="filterFormParams"
    :source="sourceList"
    :config="config"
    @getList="getList"
  >
  </UniquewayElementTableList>
</template>
<script>
import XxxComponent from '@/components/XxxComponent'
export default {
  components: {
    XxxComponent,
  }
  computed: {
    ...mapGetters({
      sourceList: 'Xxxmodule/sourceList',
    })
  },
  methods: {
    setForbidden () {},
    setUnForbidden () {},
    async getList (query = this.filterFormParams) {
      const res = await this.$store.dispatch(ProductLib.getAction('GetProductsList'), query)
      return res
    },
  }
  data () {
    return {
      loading: false,
      filterFormParams: { // 获取列表时传递的参数
        type: '',
        // ...
      },
      config: [
        {
          attrs: {
            label: '编号',
            prop: 'id',
            width: '90'
          }
        },
        {
          attrs: {
            label: '产品信息',
            width: '350'
          },
          renderComponent (data) {
            return [ // 必须为数组
              { name: 'XxxComponent', data } // 返回「组件名」和「组件需要的数据」(使用 v-model 来绑定 data)
            ]
          }
        },
        {
          attrs: {
            label: '最后更新人',
            width: '100',
            prop: 'lastModifierBy'
          }
        },
        {
          attrs: {
            label: '更新时间',
            prop: 'updatedAt'
          }
        },
        {
          attrs: {
            label: '操作',
            width: '260'
          },
          renderHTML (row) {
            return [
              {
                attrs: {
                  label: '编辑',
                  type: 'text',
                  size: 'medium'
                },
                el: 'button',
                click (row) {
                  this.$router.push(`/product_lib/products/${row.id}/edit/`)
                }
              },
              !row.isForbid ? {
                attrs: {
                  label: '禁用',
                  type: 'text',
                  size: 'medium'
                },
                el: 'button',
                click () {
                  this.setForbidden(row.id)
                }
              } : {
                attrs: {
                  label: '解除禁用',
                  type: 'text',
                  size: 'medium',
                  style: {
                    color: '#e6a23c'
                  }
                },
                el: 'button',
                click () {
                  this.setUnForbidden(row.id)
                }
              }
            ]
          }
        }
      ]
    }
  }
}
</script>
  • 示例 UniquewayElementScrollAffix
<template>
  <UniquewayElementScrollAffix>
    <div class="demo"></div>
  </UniquewayElementScrollAffix>
</template>
<style lang="scss" scoped>
  .demo {
    position: absolute;
    width: 150px;
    height: 300px;
    border: 1px solid red;
  }
</style>
  • 示例 UniquewayElementPreviewUploadSingle
<template>
  <UniquewayElementPreviewUploadSingle
    action="your API"
    v-model="value"
  />
</template>
  • 示例 UniquewayElementPreviewUploadMultiple
<template>
  <UniquewayElementPreviewUploadMultiple
    action="your API"
    v-model="imageList"
  />
</template>
<script>
export default {
  data () {
    return {
      imageList: [
        { url: '' },
        { url: '' }
      ]
    }
  }
}
</script>
  • 示例 RuleForm
<template>
  <!-- code... -->
  <el-row :gutter="24">
    <el-col :span="24">
      <el-form-item
        label="标题"
        :prop="title"
        :rules="getRequiredRules('change')"
      >
        <el-input
          v-model="value.title"
          placeholder="请输入标题"
        />
      </el-form-item>
    </el-col>
  </el-row>
  <!-- code... -->
</template>
<!-- code... -->

Dependencies

  • Vue 2.5.17
  • ElementUI 2.11.1