-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsonform.html
89 lines (86 loc) · 2.49 KB
/
jsonform.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html>
<head>
<link
href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"
rel="stylesheet"
/>
<link
href="https://cdn.jsdelivr.net/npm/@mdi/[email protected]/css/materialdesignicons.min.css"
rel="stylesheet"
/>
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.min.css"
rel="stylesheet"
/>
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@koumoul/vjsf@latest/dist/main.css"
/>
</head>
<body>
<div id="app">
<v-app>
<v-main>
<v-container>
<v-form>
<v-jsf v-model="dataModel" :schema="schema"/>
</v-form>
<br />
<pre>
{{ prettyModel }}
</pre>
</v-container>
</v-main>
</v-app>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@koumoul/vjsf@latest/dist/main.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@koumoul/vjsf@latest/dist/third-party.js"></script>
<script>
Vue.component('VJsf', VJsf.default)
new Vue({
el: "#app",
vuetify: new Vuetify(),
data: {
schema: {
$id: "https://neops.io/schema/example.json",
$schema: "http://json-schema.org/draft-07/schema#",
title: "Demo Form JSON Schma",
type: "object",
required: ["foo", "bar"],
properties: {
foo: {
title: "Foo",
type: "string",
description: "Foo rendered as normal input field",
},
bar: {
title: "Bar",
type: "string",
description: "as select",
enum: ['foo', 'bar']
},
bool: {
title: "bool",
type: "boolean",
description: "boolean is rendered as checkbox",
},
},
},
dataModel: {},
},
computed: {
prettyModel: function () {
return JSON.stringify(this.dataModel, null, 2);
}
}
});
</script>
</body>
</html>