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

@jinzhitiankai/form-making_test

v1.1.6

Published

基于Vue,ElementUI开发的一款表单设计器,提高表单开发效率的利器,让开发者从枯燥的表单代码编写中解放出来

Downloads

6

Readme

form-making

基于Vue,ElementUI开发的一款表单设计器,提高表单开发效率的利器,让开发者从枯燥的表单代码编写中解放出来

工具地址:http://tools.xiaoyaoji.cn/form

特性

  • 可视化配置页面
  • 提供栅格布局,并采用flex实现对齐
  • 一键预览配置的效果
  • 一键生成配置json数据
  • 一键生成代码,立即可运行
  • 提供自定义组件满足用户自定义需求
  • 提供远端数据接口,方便用户需要异步获取数据加载
  • 提供功能强大的高级组件
  • 支持表单验证
  • 快速获取表单数据

CDN

<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/form-making/dist/FormMaking.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/form-making/dist/FormMaking.umd.js"></script>

Install

npm install form-making -S

Quick Start

import FormMaking from 'form-making'
import 'form-making/dist/FormMaking.css'
Vue.use(FormMaking)

// or
import {
  GenerateForm
} from 'form-making'
import 'form-making/dist/FormMaking.css'

Vue.component(GenerateForm.name, GenerateForm)

Template

<fm-generate-form></fm-generate-form>

设计器引用

import {MakingForm} from 'form-making'
Vue.component(MakingForm.name, MakingForm)
<fm-making-form  preview generate-code generate-json>
    <template slot="action">
    </template>
  </fm-making-form>
props

| Prop name | Description | Type | Default value | | ------------ | ------------ | ------------ | ------------ | | preview | 预览,头部操作按钮 | Boolean | false | | generate-json | 生成JSON | Boolean | false | | generate-code | 生成代码 | Boolean | false |

methods

| Function name | Description | | ------------- | ------------------------------ | | getJSON | 获取设计器生成的JSON数据 | | getHtml | 获取生成可使用的html代码 | | setJSON(value) | 根据value值设置表单设计器 |

slots

| Slot name | Description | | ------------- | ------------------------------ | | action | 自定义设计器操作按钮,展示在设计头部区域 |

表单渲染

通过 在线地址 或者引用设计器生成的JSON,用于表单渲染

下面就是加载对应的数据用于展示,假设你已经正确加载组件

<fm-generate-form
    :data="jsonData"
    :remote="remoteFuncs"
    :value="values"
    ref="generateForm">
</fm-generate-form>
new Vue({
    ...
    data () {
        return {
            jsonData: {}, // 表单配置中生成的json数据
            values: {}, // 表单需要显示的表单数据
            remoteFuncs: {
                // 组件配置时配置的远端方法,保持和配置时输入的名称一致
                func_test (resolve) {
                  // 模拟接口请求
                  setTimeout(() => {
                    const options = [
                      {id: '1', name: '1111'},
                      {id: '2', name: '2222'},
                      {id: '3', name: '3333'}
                    ]
                    
                    // 获取到的值和标签可以通过配置页远端配置
                    // 值:id  标签:name
        
                    resolve(options) // 将后端获取的数据放入回调函数中
                  }, 2000)
                },
                func_test2....
            }
        }
    },
    methods: {
        ...{
            // 调用此方法验证表单数据和获取表单数据
            this.$refs.generateForm.getData().then(data => {
                // 数据校验成功
                // data 为获取的表单数据
            }).catch(e => {
                // 数据校验失败
            })
        }
    }
})

高级字段使用

社区资料笔记

支持

  • 如果你发现了新的 bug,或者有新的 feature request,请新建一个 issue

捐赠

如果觉得还不错,请作者喝杯咖啡吧 ☺

问题交流

QQ群:902048874