GithubHelp home page GithubHelp logo

zhaoshuai2018 / vue-json-schema-form Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lljj-x/vue-json-schema-form

0.0 1.0 0.0 2.87 MB

基于 Vue Json Schema ElementUi 快速构建一个带完整校验的form表单

Home Page: https://vue-json-schema-form.lljj.me/

License: Apache License 2.0

JavaScript 59.88% CSS 8.93% Vue 30.53% HTML 0.66%

vue-json-schema-form's Introduction

vue-json-schema-form

基于 Vue ElementUi JsonSchema快速构建一个带完整校验的form表单.

快速体验

# 安装
npm install --save @lljj/vue-json-schema-form

# 或者:
yarn add @lljj/vue-json-schema-form
<template>
    <VueForm
        v-model="formData"
        :schema="schema"
    >
    </VueForm>
</template>

<script >
    //  使用
    import VueForm from '@lljj/vue-json-schema-form';

    export default {
        name: 'Demo',
        components: {
            VueForm
        },
        data() {
            return {
                formData: {},
                schema: {
                    type: 'object',
                    required: [
                        'firstName'
                    ],
                    properties: {
                        firstName: {
                            type: 'string',
                            title: 'First name',
                            default: 'Jun'
                        },
                        lastName: {
                            type: 'string',
                            title: 'Last name'
                        },
                    }
                }
            };
        }
    };
</script>

运行Demo

# 安装依赖
yarn install

# 运行demo页 (同时运行 vue-editor,schema-form-eidtor)
yarn run demo:dev

# formEditor http://127.0.0.1:8800/
# 活动编辑器 http://127.0.0.1:8800/vue-editor.html

# 运行demo页 (单个 schema-form-eidtor)
yarn run demo:dev --dir=index

# 运行demo页 (单个 vue-editor)
yarn run demo:dev --dir=vue-editor

相关资料

JSON Schema | Vue | Element Ui

为何开发

原本是在很久前公司流产的项目类似淘宝店铺装修,也可以叫做前端可视化编辑。为了解决数据配置表单的通用性,所以使用json-schema描述数据结构,动态生成表单。

这样做的好处除了解决在每个配置表单的重复工作,服务端也可以基于同一份schema保持和前端一致的校验规则,不过对于使用 vue elementUi并未找到合适库可以直接使用,所以在后面一段时间决定自己实现一个 ..

License

Apache-2.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.