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-extends-element-ui

v1.0.7

Published

This template should help get you started developing with Vue 3 in Vite.

Downloads

8

Readme

#vue-extends-element-ui

基于element-ui封装的Table、Form组件

install

npm install --save vue-extends-element-ui

description

table中的参数

 columns: {
  type: Array,
  default: () => [],
},

fetchPage: Function, // 接口请求(方法返回promise对象)
/*
例:
父组件中的方法
fetchPages(params) {
  return api.fetchUserPage(params) //接口api
},
*/
rowClassName: {
  type: Function,
  default: () => {},
},
params: { //查询条件非必填
  type: Object,
  default: () => {},
},

form中的参数

formData: { // 参数结构
  type: Array,
  default: () => [
    {
      name: 'name',
      key: 'name',
      label: '姓名',
      component: 'el-input',
      span: 6,
      props: { placeholder: '请输入姓名', clearable: true }
      events: {
        change: ()=>{},
      },
    },
    {
      name: 'account',
      key: 'account',
      label: '姓名',
      component: 'el-input',
      span: 6,
      props: { placeholder: '请输入姓名', clearable: true }
      events: {
        change: ()=>{},
      },
    },
    {
      name: 'org',
      key: 'org',
      label: '职位',
      span: 6,
      component: 'el-select',
      props: { placeholder: '请选择职位' },
      childComponent: 'el-option',
      childProps: { label: "name", value: "code" }, // 可自定义options子组件的中label、value的key
      options: [{ label: '职位1', code: 1 }, { label: '职位2', code: 0 }]
      events: {
        change: ()=>{},
      },
    },
    {
      name: 'date',
      key: 'date',
      span: 6,
      label: '日期选择',
      component: 'el-date-picker',
      props: { placeholder: '选择时间' }
      events: {
        change: ()=>{},
      },
    },
    {
      name: 'time',
      key: 'time',
      span: 6,
      label: '时间选择',
      component: 'el-time-picker',
      props: { placeholder: '选择时间' }
      events: {
        change: ()=>{},
      },
    },
    {
      name: 'checkboxGroup',
      key: 'checkboxGroup',
      label: 'checkbox选择',
      span: 6,
      component: 'el-checkbox-group',
      childComponent: 'el-checkbox', // 渲染的子组件
      options: [{ label: '启用', name: 'type', key: 'city' }, { label: '封存', name: 'type', key: 'city1' }] // 子组件的数据及属性配置
      events: {
        change: ()=>{},
      },
    },
    {
      name: 'selectTree', // formItem绑定prop(关系到数据的提交值)
      key: 'selectTree',  // 渲染时的key值(在checkboxGroup时必须为'checkboxGroup')解决checkboxGroup组prop数据必须存在的问题详见github
      label: 'tree选择',  // label名
      span: 6,  // 详见el-col(默认24)
      component: SelectTree, // formItem显示的view (如自定组件需要import导入)
      props: { // formItem上的所有属性都在这里写 (详见form-item参数)
        options: [{ id: '-1', parentId: '-1', level: 0, name: '根组织' },
          {
            id: '1',
            parentId: '-1',
            level: 0,
            name: '根组织1',
            children: [{
              id: '2', parentId: '1', level: 0, name: '根组织2'
            }]
          }]
      }
      events: {
        change: ()=>{},
      },
    }
  ],
  required: true,
},
//  表单数据处理(上个版本在组件内部,考虑到不同的业务场景决定当作参数传递。)
form: {
  type: Object,
  default: () => {},
  required: true,
},
labelWidth: {
  type: [String, Number],
  default: '1.2rem'
},
// formItem之间的间隔 详见element-ui中el-row
gutter: {
  type: Number,
  default: 0
},
// form表单校验规则 详见element-ui中form
rules: {
  type: Object,
  default: () => { }
},
// formItem对齐方式
justify: {
  type: String,
  default: 'start'
}
// labelPosition位置
labelPosition: {
  type: String,
  default: 'left'
}

usage

    //  这里引入element-ui或者element-plus都可以(如果是全局引入)
    import ElementPlus from "element-plus";
    import VueExtendsElementUi from 'vue-extends-element-ui'
    import "element-plus/dist/index.css";

    Vue.use(VueExtendsElementUi)
  //  使用的组件
  
  <template>
    <div class="app">
      <table-ui :columns="columns" />
      // 按需导入的使用
      //<Form />
      
      // 全局导入
      <form-ui />
    </div>
  </template>

<script>
import Form from 'vue-extends-element-ui'

export default {
  data() {
    return {
      columns: [
        {
          dataIndex: "index",
          label: "序号",
          type: "index",
          width: "80",
          fixed: "left",
        },
        {
          dataIndex: "assName",
          label: "积分类别",
          minWidth: "150",
          fixed: "left",
        },
        {
          dataIndex: "assConfigName",
          label: "积分内容",
          minWidth: "300",
          "show-overflow-tooltip": true,
        },
      ],
    };
  },
  mounted() {},
  components:{
    Form
  }
};
</script>