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

@xpf0000/vue-element-form

v1.0.1

Published

### 安装 ```js npm install @xpf0000/vue-element-form ```

Downloads

3

Readme

vue elementu-ui form扩展

安装

npm install @xpf0000/vue-element-form

使用

// 引用
import Vue from 'vue'
import Base from '@xpf0000/vue-element-form'
Vue.use(Base, {
  labelWidth: '200px',   // 标题宽度
  labelPosition: 'left', // 标题位置  left|right|top
  maxLabelFont: 10       // 标题最大字符 超出会自动变为top上下结构
})

<template>
  <div id="app">
    <BaseForm ref="baseForm" :list="list" :form="form" :rules="rules">
      <template #自定义>
        <el-input v-model="form.xxx" style="width: 300px"></el-input>
        <el-button>选择</el-button>
      </template>
    </BaseForm>
    <el-button @click="doSubmit">确定</el-button>
  </div>
</template>

<script>
  export default {
    name: 'App',
    data() {
      return {
        list: [
          {
            type: 'input',
            label: '输入框',
            prop: 'name',
            placeholder: '请输入姓名'
          },
          {
            type: 'password',
            label: '密码框',
            prop: 'password',
            placeholder: '请输入密码'
          },
          {
            type: 'textarea',
            label: '文本框',
            prop: 'text',
            placeholder: '请输入'
          },
          {
            type: 'image',
            label: '用户头像',
            prop: 'image',
            choose: this.chooseImg
          },
          {
            type: 'images',
            label: '商品轮播图123',
            prop: 'images',
            max: 6,
            choose: this.chooseImg
          },
          {
            type: 'select',
            label: '下拉框',
            prop: 'select',
            options: [
              {
                label: '选项1',
                value: '1'
              },
              {
                label: '选项2',
                value: '2'
              },
              {
                label: '选项3',
                value: '3'
              }
            ]
          },
          {
            type: 'checkbox',
            label: '复选框',
            prop: 'checkbox',
            options: [
              {
                label: '选项1',
                value: '1'
              },
              {
                label: '选项2',
                value: '2'
              },
              {
                label: '选项3',
                value: '3'
              }
            ]
          },
          {
            type: 'radio',
            label: '单选框',
            prop: 'radio',
            options: [
              {
                label: '选项1',
                value: '1'
              },
              {
                label: '选项2',
                value: '2'
              },
              {
                label: '选项3',
                value: '3'
              }
            ]
          },
          {
            type: 'date',
            label: '日期选择',
            prop: 'date'
          },
          {
            type: 'datetime',
            label: '日期时间选择',
            prop: 'datetime'
          },
          {
            type: 'daterange',
            label: '日期时间范围',
            prop: 'daterange'
          },
          {
            label: '自定义',
            prop: 'xxx'
          }
        ],
        form: {
          name: '张三',
          image: { id: 0, image: '' },
          images: [],
          checkbox: [],
          radio: '',
          date: null,
          datetime: null,
          daterange: [],
          xxx: ''
        },
        rules: {
          name: [
            {
              required: true, //是否必填
              message: '姓名不能为空', //规则提示
              trigger: 'blur' //何事件触发
            }
          ]
        }
      }
    },
    mounted() {},
    methods: {
      chooseImg(vm) {
        vm.value = {
          id: vm.index,
          image:
            'https://1.s131i.faiusr.com/4/AIMBCAAQBBgAIKzfhvsFKLX-j9oFMKYDONgE.png?t=' +
            vm.index
        }
      },
      doSubmit() {
        this.$refs.baseForm.$refs.form.validate(async (valid) => {
          //如果验证通过
          if (valid) {
            console.log('验证通过 !!!', this.form)
          } else {
            return false
          }
        })
      }
    }
  }
</script>