0.1.13 • Published 5 years ago

nx-json-form v0.1.13

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

nx-json-editor

Usage example

<template>
  <div>
    <NxJsonForm
      :schema="schema"
      v-model="form"
      :disable-collapse="disableCollapse"
      :disable-edit-json="disableEditJson"
      :disable-properties="disableProperties"
    />
  </div>
</template>

<script>
import NxJsonForm from "@/components/nx-json-form/NxJsonForm";
import "bootstrap/dist/css/bootstrap.min.css";

export default {
  components: {
    NxJsonForm,
  },
  data() {
    return {
      schema: {},
      form: {},
      disableCollapse: true,
      disableEditJson: true,
      disableProperties: true,
    };
  },
  created() {
    this.setSchema();
    this.setSchemaValue();
  },
  methods: {
    setSchemaValue() {
      this.form = { name: "SchemaA", age: 20, favorite_color: "#ffa500" };
    },
    setSchema() {
      this.schema = {
        type: "object",
        required: ["name", "age", "favorite_color"],
        properties: {
          name: {
            type: "string",
            description: "First and Last name",
            minLength: 4,
            default: "Jeremy Dorn",
          },
          age: {
            type: "integer",
            default: 25,
            minimum: 18,
            maximum: 99,
          },
          favorite_color: {
            type: "string",
            format: "color",
            title: "favorite color",
            default: "#ffa500",
          },
        },
      };
    },
  },
};
</script>
0.1.12

5 years ago

0.1.13

5 years ago

0.1.11

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.2

5 years ago

0.1.3

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago