1.1.32 • Published 5 years ago

vue-form10 v1.1.32

Weekly downloads
351
License
-
Repository
-
Last release
5 years ago

vue-form10

Install

npm i -S vue-form10

Usage

<template>
  <div id="app">
    <Form10 :schema="schema" :plugins="form10plugins" v-model="model"/>
    <pre>{{JSON.stringify(model,false,4)}}
    </pre>
  </div>
</template>

<script>
import Form10 from 'vue-form10';
import form10plugins from 'vue-form10/libs/plugins';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import Vue from 'vue';

Vue.use(ElementUI);

export default {
  name: 'app',
  data() {
    return {
      model:{

      },
      form10plugins,
      schema: {
        type: 'object',
        title: 'obj',
        properties: {
          str: {
            type: 'string',
            title: 'str',
          },
          obj: {
            type: 'object',
            title: 'obj',
            properties: {
              str: {
                type: 'string',
                title: 'str',
              },
            },
          },
        },
      },
    };
  },
  components: {
    Form10,
  },
};
</script>

Props

v-model

Form10's model

options

Type:Object
Required:false

options.inline

Type:Boolean
Required:false
If the label and the input are on the same line.

options.formProps

Type:Object
Required:false
Pass to form10's topmost el-form component.

options.inheritState

Type:Object
Required:false
Used to compose form10's vuex state. Form10 has its own vuex state, so its format plugins can't access its $parent's state. Pass this.$store.state to this option and the format plugins can access the state by this.$store.state.inherit.

options.typeDefaultFormat

Type:Object
Required:false
Default:{ object: "object", array: "array", number: "number", integer: "number", string: "string", boolean: "boolean", null: "null" }
If a schema has type but doesn't have format, form10 uses typeDefaultFormat[type] to decide its format.

schema

Type:Object
Required:true

plugins

Type:Array
Required:true

Methods

submit

Function():Object

Returns: If has error: { error }
If not: { value }

Reference

Json Schema Validation

Compared with angular-schema-form

  • required:"a","b"
  • key: "address.street"
  • type: "text"
  • title: "Street"
  • notitle: false
  • description: "Street name"
  • validationMessage: "Oh noes, please write a proper address"
  • onChange: "valueChanged(form.key,modelValue)"
  • (won't support) feedback: false(try to set :status-icon="true" on el-form)
  • disableSuccessState: false
  • disableErrorState: false
  • placeholder: "Input..."
  • (won't support) ngModelOptions: { ... }
  • readonly: true
  • htmlClass: "street foobar"
  • (won't support) fieldHtmlClass: "street"
  • (won't support) labelHtmlClass: "street"
  • copyValueTo: "address.street" (can't differentiate user input and model change though)
  • condition: "person.age < 18"
  • destroyStrategy: "remove"
1.1.32

5 years ago

1.1.31

5 years ago

1.1.30

5 years ago

1.1.29

6 years ago

1.1.28

6 years ago

1.1.27

6 years ago

1.1.26

6 years ago

1.1.25

6 years ago

1.1.24

6 years ago

1.1.23

6 years ago

1.1.22

6 years ago

1.1.21

6 years ago

1.1.20

6 years ago

1.1.19

6 years ago

1.1.18

6 years ago

1.1.17

6 years ago

1.1.16

6 years ago

1.1.15

6 years ago

1.1.14

6 years ago

1.1.13

6 years ago

1.1.12

6 years ago

1.1.11

6 years ago

1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.0.57

6 years ago

1.0.56

6 years ago

1.0.55

6 years ago

1.0.54

6 years ago

1.0.53

6 years ago

1.0.52

6 years ago

1.0.51

6 years ago

1.0.50

6 years ago

1.0.49

6 years ago

1.0.48

6 years ago

1.0.47

6 years ago

1.0.46

6 years ago

1.0.45

6 years ago

1.0.44

6 years ago

1.0.43

6 years ago

1.0.42

6 years ago

1.0.41

6 years ago

1.0.40

6 years ago

1.0.39

6 years ago

1.0.38

6 years ago

1.0.37

6 years ago

1.0.36

6 years ago

1.0.35

6 years ago

1.0.34

6 years ago

1.0.33

6 years ago

1.0.32

6 years ago

1.0.31

6 years ago

1.0.30

6 years ago

1.0.29

6 years ago

1.0.28

6 years ago

1.0.27

6 years ago

1.0.26

6 years ago

1.0.25

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago